pi-clickable-links 0.0.0-stage → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bbjson
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.de.md ADDED
@@ -0,0 +1,169 @@
1
+ # pi-clickable-links
2
+
3
+ [English](README.md) · [简体中文](README.zh-CN.md) · [繁體中文](README.zh-TW.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Español](README.es.md) · [Français](README.fr.md) · **Deutsch** · [Русский](README.ru.md)
4
+
5
+ Anklickbare **Dateipfade** und **URLs** in [pi](https://pi.dev)-Transkripten.
6
+
7
+ - **Pfad** → öffnet den übergeordneten Ordner im Dateimanager und wählt die Datei aus
8
+ (es wird nie geraten, mit welcher Anwendung sie geöffnet werden soll).
9
+ - **URL** → öffnet den Standardbrowser.
10
+
11
+ Es wird nichts irgendwohin gesendet; die Erweiterung schreibt nur das angezeigte Markdown um,
12
+ Sitzung und Modellkontext bleiben unverändert.
13
+
14
+ ```
15
+ see /home/you/projects/api/src/server.ts:42 ← Klick: Dateimanager in src/, server.ts ausgewählt
16
+ docs: https://example.com/guide ← Klick: Standardbrowser
17
+ ```
18
+
19
+ ## Warum eine Erweiterung und ein URI-Handler
20
+
21
+ Ein Terminal kann nur URLs „anklicken“, die pi als
22
+ [OSC 8](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)-Hyperlinks
23
+ ausgibt, und das Terminal übergibt diese URIs an den Standard-Handler des Desktops.
24
+ Deshalb zwei Hälften:
25
+
26
+ | Hälfte | Datei | Aufgabe |
27
+ |---|---|---|
28
+ | pi-Erweiterung | `src/open-links.ts` | schreibt Pfade in `pi-open://open?p=…`-Links um, URLs bleiben `http(s)` |
29
+ | URI-Handler | `bin/pi-open` | nimmt den Klick, löst den Pfad auf und zeigt ihn im Dateimanager (`nautilus --select`), oder ruft `xdg-open` für URLs auf |
30
+
31
+ ## Voraussetzungen
32
+
33
+ - pi 1.7 oder neuer
34
+ - Ein Terminal mit OSC-8-Unterstützung (GNOME Terminal / VTE, kitty, foot, WezTerm, iTerm2, …)
35
+ - `python3` (der Handler ist ein kleines Skript nur mit der Standardbibliothek)
36
+ - Linux-Desktop mit `xdg-mime`; Nautilus wird genutzt, wenn vorhanden, sonst `xdg-open`
37
+
38
+ ## Installation
39
+
40
+ ### 1. Die Erweiterung
41
+
42
+ ```bash
43
+ # von GitHub
44
+ pi install git:github.com/bbjson/pi-clickable-links
45
+
46
+ # oder von npm
47
+ pi install npm:pi-clickable-links
48
+
49
+ # oder aus einem lokalen Checkout
50
+ git clone https://github.com/bbjson/pi-clickable-links
51
+ cd pi-clickable-links
52
+ ./install.sh --link-extension
53
+ ```
54
+
55
+ ### 2. Der URI-Handler
56
+
57
+ In der ersten Sitzung nach der Installation installiert die Erweiterung Handler und
58
+ Desktop-Eintrag selbst und meldet es im Statusbereich — kein manueller Schritt nötig.
59
+ Führe den Installer selbst aus, um es vorab zu erledigen (oder nach dem Verschieben von
60
+ Dateien zu wiederholen):
61
+
62
+ ```bash
63
+ ./install.sh
64
+ ```
65
+
66
+ Er wird:
67
+
68
+ 1. `bin/pi-open` nach `~/.local/bin/pi-open` kopieren
69
+ 2. `~/.local/share/applications/pi-open.desktop` schreiben und das Schema `pi-open://`
70
+ mit `xdg-mime` registrieren
71
+ 3. `terminal.hyperlinks: true` in `~/.pi/agent/settings.json` setzen (vorher wird eine
72
+ Sicherung mit Zeitstempel angelegt; mit `--no-settings` überspringen)
73
+
74
+ Von Hand geht es auch:
75
+
76
+ ```bash
77
+ install -m 0755 bin/pi-open ~/.local/bin/pi-open
78
+ sed "s|@PI_OPEN_BIN@|$HOME/.local/bin/pi-open|" share/pi-open.desktop.in \
79
+ > ~/.local/share/applications/pi-open.desktop
80
+ update-desktop-database ~/.local/share/applications
81
+ xdg-mime default pi-open.desktop x-scheme-handler/pi-open
82
+ ```
83
+
84
+ ### 3. pi neu starten
85
+
86
+ Erweiterungen und Einstellungen werden beim Start gelesen. `/reload` ausführen oder pi
87
+ neu starten.
88
+
89
+ > ### Warum `terminal.hyperlinks: true` nötig ist
90
+ > pi entscheidet anhand von `TERM_PROGRAM`, ob es OSC-8-Links ausgeben darf. GNOME Terminal
91
+ > (VTE) setzt diese Variable nicht, also deaktiviert pi Hyperlinks standardmäßig und das
92
+ > Transkript enthält gar keine Links — auch nicht bei einfachen `https://`-URLs. Die
93
+ > Einstellung zu erzwingen behebt beides. Bei Terminals, die `TERM_PROGRAM` setzen (kitty,
94
+ > WezTerm, iTerm2, …), ist sie überflüssig, aber harmlos.
95
+
96
+ ## Verwendung
97
+
98
+ Klicke einen Pfad oder eine URL im Transkript an.
99
+
100
+ Auch per Tastatur nutzbar, selbst ohne OSC-8-Unterstützung:
101
+
102
+ ```
103
+ /open /home/you/projects/api/src/server.ts
104
+ /open https://example.com/guide
105
+ /open ~/Downloads
106
+ ```
107
+
108
+ ## Was verlinkt wird
109
+
110
+ | Eingabe im Transkript | Ergebnis |
111
+ |---|---|
112
+ | `/home/you/app/main.py` | anklickbar → Dateimanager öffnet `app/`, `main.py` ausgewählt |
113
+ | `~/Downloads` | anklickbar → öffnet `~/Downloads` |
114
+ | `/home/you/app/main.py:42` | anklickbar, `:42` bleibt im Label, Datei ausgewählt |
115
+ | `/home/you/My Documents/notes.md` | anklickbar (Leerzeichen werden behandelt) |
116
+ | `/home/you/videos/08.mp4` | anklickbar (Nicht-ASCII prozentkodiert im URI) |
117
+ | `https://example.com` | pi verlinkt es selbst, zeigt auf die URL |
118
+ | `` `cat /home/you/file` `` / Codeblock | **bleibt Code**, nicht verlinkt |
119
+ | `[docs](/home/you/file.md)` (schon ein Link) | **unverändert** |
120
+ | `/home/you/does-not-exist.txt` | kein Link, bleibt reiner Text |
121
+ | `src/app.ts` (relativ) | kein Link — ein relativer Pfad ist beim Klick nicht auflösbar |
122
+
123
+ ## Konfiguration
124
+
125
+ | Variable | Wirkung |
126
+ |---|---|
127
+ | `PI_OPEN_DRY=1` | der Handler gibt nur aus, was er ausführen würde |
128
+ | `PI_OPEN_BIN` | Pfad zum Handler, falls nicht unter `~/.local/bin` installiert |
129
+
130
+ Der Dateimanager wird oben in `bin/pi-open` gewählt (`nautilus`, wenn vorhanden, sonst
131
+ `xdg-open`). Für Thunar, Nemo, Dolphin, … dort `FM` ändern.
132
+
133
+ ## Fehlerbehebung
134
+
135
+ | Symptom | Ursache / Lösung |
136
+ |---|---|
137
+ | Gar keine Link-Optik, auch nicht bei `https://` | `terminal.hyperlinks` ist aus: `./install.sh` erneut ausführen, pi neu starten |
138
+ | Link ist gestylt, Klick tut nichts | das Terminal kann das Schema nicht öffnen: `xdg-mime query default x-scheme-handler/pi-open` prüfen |
139
+ | Klick öffnet einen Texteditor statt des Ordners | das ist ein von pi gerenderter `file://`-Link (Pfade aus Tool-Ausgaben), der diesen Handler umgeht; klicke den Pfad im Assistententext |
140
+ | Nichts passiert bei Pfaden mit Leerzeichen | der Pfad muss beim Rendern existieren — die Erweiterung verlinkt nur existierende absolute Pfade |
141
+ | `pi-open: command not found` | `./install.sh` ausführen (Schritt 2) |
142
+ | Vollbild schluckt Klicks | beim Klicken `Ctrl+Shift` halten, dann greift die native Link-Behandlung des Terminals |
143
+
144
+ Handler direkt zum Debuggen ausführen:
145
+
146
+ ```bash
147
+ PI_OPEN_DRY=1 ~/.local/bin/pi-open 'pi-open://open?p=/home/you/Desktop'
148
+ ```
149
+
150
+ ## Tests
151
+
152
+ ```bash
153
+ npm test # node >= 22: TypeScript wird nativ entfernt
154
+ ```
155
+
156
+ - `test/linkify.mjs` — Markdown-Transformer (Pfade, Codeblöcke, Leerzeichen, CJK, `:zeile`-Suffixe)
157
+ - `test/setup.mjs` — Selbstinstallation, in einem Wegwerf-`$HOME`
158
+
159
+ ## Deinstallation
160
+
161
+ ```bash
162
+ ./uninstall.sh
163
+ pi remove git:github.com/bbjson/pi-clickable-links
164
+ # optional terminal.hyperlinks in ~/.pi/agent/settings.json zurücksetzen
165
+ ```
166
+
167
+ ## Lizenz
168
+
169
+ MIT — siehe [LICENSE](LICENSE).
package/README.es.md ADDED
@@ -0,0 +1,168 @@
1
+ # pi-clickable-links
2
+
3
+ [English](README.md) · [简体中文](README.zh-CN.md) · [繁體中文](README.zh-TW.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · **Español** · [Français](README.fr.md) · [Deutsch](README.de.md) · [Русский](README.ru.md)
4
+
5
+ **Rutas de archivo** y **URL** en las transcripciones de [pi](https://pi.dev) que se pueden pulsar.
6
+
7
+ - **Ruta** → abre la carpeta contenedora en tu gestor de archivos con el archivo seleccionado
8
+ (nunca adivina con qué aplicación abrirlo).
9
+ - **URL** → se abre en tu navegador predeterminado.
10
+
11
+ No se envía nada a ninguna parte; la extensión solo reescribe el Markdown para mostrarlo,
12
+ así que la sesión y el contexto del modelo quedan intactos.
13
+
14
+ ```
15
+ see /home/you/projects/api/src/server.ts:42 ← clic: gestor de archivos en src/, server.ts seleccionado
16
+ docs: https://example.com/guide ← clic: navegador predeterminado
17
+ ```
18
+
19
+ ## Por qué una extensión y un manejador de URI
20
+
21
+ Un terminal solo puede "pulsar" las URL que pi emite como hipervínculos
22
+ [OSC 8](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda), y el terminal
23
+ entrega esos URI al manejador predeterminado del escritorio. Por eso hay dos mitades:
24
+
25
+ | Mitad | Archivo | Función |
26
+ |---|---|---|
27
+ | Extensión de pi | `src/open-links.ts` | reescribe las rutas como enlaces `pi-open://open?p=…`; las URL siguen siendo `http(s)` |
28
+ | Manejador de URI | `bin/pi-open` | recibe el clic, resuelve la ruta y la revela en el gestor de archivos (`nautilus --select`), o llama a `xdg-open` para URL |
29
+
30
+ ## Requisitos
31
+
32
+ - pi 1.7 o superior
33
+ - Un terminal con soporte de hipervínculos OSC 8 (GNOME Terminal / VTE, kitty, foot,
34
+ WezTerm, iTerm2, …)
35
+ - `python3` (el manejador es un script pequeño solo con la biblioteca estándar)
36
+ - Escritorio Linux con `xdg-mime`; se usa Nautilus cuando está presente, si no `xdg-open`
37
+
38
+ ## Instalación
39
+
40
+ ### 1. La extensión
41
+
42
+ ```bash
43
+ # desde GitHub
44
+ pi install git:github.com/bbjson/pi-clickable-links
45
+
46
+ # o desde npm
47
+ pi install npm:pi-clickable-links
48
+
49
+ # o desde un clon local
50
+ git clone https://github.com/bbjson/pi-clickable-links
51
+ cd pi-clickable-links
52
+ ./install.sh --link-extension
53
+ ```
54
+
55
+ ### 2. El manejador de URI
56
+
57
+ En la primera sesión después de instalar, la extensión instala el manejador y la entrada de
58
+ escritorio por sí misma y te lo indica en la barra de estado; no hace falta ningún paso
59
+ manual. Ejecuta el instalador tú mismo para hacerlo de antemano (o para rehacerlo tras
60
+ mover archivos):
61
+
62
+ ```bash
63
+ ./install.sh
64
+ ```
65
+
66
+ Hará lo siguiente:
67
+
68
+ 1. copiar `bin/pi-open` a `~/.local/bin/pi-open`
69
+ 2. escribir `~/.local/share/applications/pi-open.desktop` y registrar el esquema
70
+ `pi-open://` con `xdg-mime`
71
+ 3. poner `terminal.hyperlinks: true` en `~/.pi/agent/settings.json` (antes se crea una copia
72
+ de seguridad con marca de tiempo; omítelo con `--no-settings`)
73
+
74
+ Hacerlo a mano también vale:
75
+
76
+ ```bash
77
+ install -m 0755 bin/pi-open ~/.local/bin/pi-open
78
+ sed "s|@PI_OPEN_BIN@|$HOME/.local/bin/pi-open|" share/pi-open.desktop.in \
79
+ > ~/.local/share/applications/pi-open.desktop
80
+ update-desktop-database ~/.local/share/applications
81
+ xdg-mime default pi-open.desktop x-scheme-handler/pi-open
82
+ ```
83
+
84
+ ### 3. Reinicia pi
85
+
86
+ Las extensiones y los ajustes se leen al arrancar. Ejecuta `/reload` o reinicia pi.
87
+
88
+ > ### Por qué hace falta `terminal.hyperlinks: true`
89
+ > pi decide si puede emitir enlaces OSC 8 a partir de `TERM_PROGRAM`. GNOME Terminal (VTE)
90
+ > no define esa variable, así que pi desactiva los hipervínculos por defecto y la
91
+ > transcripción no contiene ningún enlace, ni siquiera para URL `https://` normales.
92
+ > Forzar el ajuste lo arregla. Si tu terminal define `TERM_PROGRAM` (kitty, WezTerm,
93
+ > iTerm2, …), el ajuste es redundante pero inofensivo.
94
+
95
+ ## Uso
96
+
97
+ Pulsa cualquier ruta o URL de la transcripción.
98
+
99
+ También funciona con el teclado, incluso sin soporte OSC 8:
100
+
101
+ ```
102
+ /open /home/you/projects/api/src/server.ts
103
+ /open https://example.com/guide
104
+ /open ~/Downloads
105
+ ```
106
+
107
+ ## Qué se convierte en enlace
108
+
109
+ | Entrada en la transcripción | Resultado |
110
+ |---|---|
111
+ | `/home/you/app/main.py` | pulsable → abre `app/` con `main.py` seleccionado |
112
+ | `~/Downloads` | pulsable → abre `~/Downloads` |
113
+ | `/home/you/app/main.py:42` | pulsable, `:42` se queda en la etiqueta, archivo seleccionado |
114
+ | `/home/you/My Documents/notes.md` | pulsable (con espacios) |
115
+ | `/home/you/vídeos/08.mp4` | pulsable (no ASCII codificado en porcentaje dentro del URI) |
116
+ | `https://example.com` | pi lo enlaza por sí mismo, apuntando a la URL |
117
+ | `` `cat /home/you/file` `` / bloque de código | **se deja como código**, sin enlace |
118
+ | `[docs](/home/you/file.md)` (ya es un enlace) | **se deja igual** |
119
+ | `/home/you/does-not-exist.txt` | sin enlace, queda como texto plano |
120
+ | `src/app.ts` (relativa) | sin enlace — una ruta relativa no se puede resolver al pulsar |
121
+
122
+ ## Configuración
123
+
124
+ | Variable | Efecto |
125
+ |---|---|
126
+ | `PI_OPEN_DRY=1` | el manejador imprime lo que ejecutaría en lugar de abrir nada |
127
+ | `PI_OPEN_BIN` | ruta del manejador, si no lo instalaste en `~/.local/bin` |
128
+
129
+ El gestor de archivos se elige al principio de `bin/pi-open` (se usa `nautilus` si está
130
+ presente, si no `xdg-open`). Cambia `FM` ahí para Thunar, Nemo, Dolphin, …
131
+
132
+ ## Solución de problemas
133
+
134
+ | Síntoma | Causa / solución |
135
+ |---|---|
136
+ | Ningún enlace tiene estilo, ni siquiera las URL `https://` | `terminal.hyperlinks` está desactivado: vuelve a ejecutar `./install.sh` y reinicia pi |
137
+ | El enlace se ve pero al pulsar no pasa nada | el terminal no puede abrir el esquema: revisa `xdg-mime query default x-scheme-handler/pi-open` |
138
+ | Al pulsar se abre un editor de texto en vez de la carpeta | es un enlace `file://` que pinta pi (rutas de salida de herramientas), que no pasa por este manejador; pulsa la ruta del texto del asistente |
139
+ | Nada ocurre con rutas que tienen espacios | la ruta debe existir al renderizar: la extensión solo enlaza rutas absolutas existentes |
140
+ | `pi-open: command not found` | ejecuta `./install.sh` (paso 2) |
141
+ | El modo pantalla completa se come los clics | mantén `Ctrl+Shift` al pulsar para usar el manejo nativo de enlaces del terminal |
142
+
143
+ Ejecuta el manejador directamente para depurar:
144
+
145
+ ```bash
146
+ PI_OPEN_DRY=1 ~/.local/bin/pi-open 'pi-open://open?p=/home/you/Desktop'
147
+ ```
148
+
149
+ ## Pruebas
150
+
151
+ ```bash
152
+ npm test # node >= 22: TypeScript se elimina de forma nativa
153
+ ```
154
+
155
+ - `test/linkify.mjs` — transformador de Markdown (rutas, bloques de código, espacios, CJK, sufijos `:línea`)
156
+ - `test/setup.mjs` — ruta de autoinstalación, en un `$HOME` desechable
157
+
158
+ ## Desinstalación
159
+
160
+ ```bash
161
+ ./uninstall.sh
162
+ pi remove git:github.com/bbjson/pi-clickable-links
163
+ # opcionalmente revierte terminal.hyperlinks en ~/.pi/agent/settings.json
164
+ ```
165
+
166
+ ## Licencia
167
+
168
+ MIT — ver [LICENSE](LICENSE).
package/README.fr.md ADDED
@@ -0,0 +1,169 @@
1
+ # pi-clickable-links
2
+
3
+ [English](README.md) · [简体中文](README.zh-CN.md) · [繁體中文](README.zh-TW.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Español](README.es.md) · **Français** · [Deutsch](README.de.md) · [Русский](README.ru.md)
4
+
5
+ Des **chemins de fichiers** et des **URL** cliquables dans les transcriptions de
6
+ [pi](https://pi.dev).
7
+
8
+ - **Chemin** → ouvre le dossier parent dans votre gestionnaire de fichiers avec le fichier
9
+ sélectionné (sans deviner avec quelle application l'ouvrir).
10
+ - **URL** → s'ouvre dans votre navigateur par défaut.
11
+
12
+ Rien n'est envoyé nulle part ; l'extension ne réécrit que le Markdown affiché, la session et
13
+ le contexte du modèle restent intacts.
14
+
15
+ ```
16
+ see /home/you/projects/api/src/server.ts:42 ← clic : gestionnaire de fichiers sur src/, server.ts sélectionné
17
+ docs: https://example.com/guide ← clic : navigateur par défaut
18
+ ```
19
+
20
+ ## Pourquoi une extension et un gestionnaire d'URI
21
+
22
+ Un terminal ne peut « cliquer » que les URL que pi émet comme hyperliens
23
+ [OSC 8](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda), et le terminal
24
+ transmet ces URI au gestionnaire par défaut du bureau. D'où deux moitiés :
25
+
26
+ | Moitié | Fichier | Rôle |
27
+ |---|---|---|
28
+ | extension pi | `src/open-links.ts` | réécrit les chemins en liens `pi-open://open?p=…`, les URL restent `http(s)` |
29
+ | gestionnaire d'URI | `bin/pi-open` | reçoit le clic, résout le chemin et le révèle dans le gestionnaire de fichiers (`nautilus --select`), ou appelle `xdg-open` pour une URL |
30
+
31
+ ## Prérequis
32
+
33
+ - pi 1.7 ou plus récent
34
+ - Un terminal compatible hyperliens OSC 8 (GNOME Terminal / VTE, kitty, foot, WezTerm,
35
+ iTerm2, …)
36
+ - `python3` (le gestionnaire est un petit script, bibliothèque standard uniquement)
37
+ - Bureau Linux avec `xdg-mime` ; Nautilus est utilisé s'il est présent, sinon `xdg-open`
38
+
39
+ ## Installation
40
+
41
+ ### 1. L'extension
42
+
43
+ ```bash
44
+ # depuis GitHub
45
+ pi install git:github.com/bbjson/pi-clickable-links
46
+
47
+ # ou depuis npm
48
+ pi install npm:pi-clickable-links
49
+
50
+ # ou depuis un clone local
51
+ git clone https://github.com/bbjson/pi-clickable-links
52
+ cd pi-clickable-links
53
+ ./install.sh --link-extension
54
+ ```
55
+
56
+ ### 2. Le gestionnaire d'URI
57
+
58
+ À la première session après l'installation, l'extension installe elle-même le gestionnaire
59
+ et l'entrée de bureau, et vous le signale dans la zone d'état — aucune étape manuelle.
60
+ Lancez l'installeur vous-même pour le faire à l'avance (ou pour le refaire après avoir
61
+ déplacé des fichiers) :
62
+
63
+ ```bash
64
+ ./install.sh
65
+ ```
66
+
67
+ Il va :
68
+
69
+ 1. copier `bin/pi-open` vers `~/.local/bin/pi-open`
70
+ 2. écrire `~/.local/share/applications/pi-open.desktop` et enregistrer le schéma
71
+ `pi-open://` avec `xdg-mime`
72
+ 3. mettre `terminal.hyperlinks: true` dans `~/.pi/agent/settings.json` (une sauvegarde
73
+ horodatée est créée d'abord ; passez `--no-settings` pour l'éviter)
74
+
75
+ Le faire à la main fonctionne aussi :
76
+
77
+ ```bash
78
+ install -m 0755 bin/pi-open ~/.local/bin/pi-open
79
+ sed "s|@PI_OPEN_BIN@|$HOME/.local/bin/pi-open|" share/pi-open.desktop.in \
80
+ > ~/.local/share/applications/pi-open.desktop
81
+ update-desktop-database ~/.local/share/applications
82
+ xdg-mime default pi-open.desktop x-scheme-handler/pi-open
83
+ ```
84
+
85
+ ### 3. Redémarrer pi
86
+
87
+ Les extensions et les réglages sont lus au démarrage. Lancez `/reload` ou redémarrez pi.
88
+
89
+ > ### Pourquoi `terminal.hyperlinks: true` est indispensable
90
+ > pi décide s'il peut émettre des liens OSC 8 d'après `TERM_PROGRAM`. GNOME Terminal (VTE)
91
+ > ne définit pas cette variable, donc pi désactive les hyperliens par défaut et la
92
+ > transcription ne contient aucun lien — même pour de simples URL `https://`. Forcer le
93
+ > réglage corrige les deux. Si votre terminal définit `TERM_PROGRAM` (kitty, WezTerm, iTerm2,
94
+ > …), le réglage est superflu mais inoffensif.
95
+
96
+ ## Utilisation
97
+
98
+ Cliquez n'importe quel chemin ou URL de la transcription.
99
+
100
+ Également accessible au clavier, même sans support OSC 8 :
101
+
102
+ ```
103
+ /open /home/you/projects/api/src/server.ts
104
+ /open https://example.com/guide
105
+ /open ~/Downloads
106
+ ```
107
+
108
+ ## Ce qui devient un lien
109
+
110
+ | Saisie dans la transcription | Résultat |
111
+ |---|---|
112
+ | `/home/you/app/main.py` | cliquable → ouvre `app/` avec `main.py` sélectionné |
113
+ | `~/Downloads` | cliquable → ouvre `~/Downloads` |
114
+ | `/home/you/app/main.py:42` | cliquable, `:42` reste dans le libellé, fichier sélectionné |
115
+ | `/home/you/My Documents/notes.md` | cliquable (espaces gérés) |
116
+ | `/home/you/vidéos/08.mp4` | cliquable (non-ASCII encodé en pourcentage dans l'URI) |
117
+ | `https://example.com` | pi le transforme lui-même en lien vers l'URL |
118
+ | `` `cat /home/you/file` `` / bloc de code | **laissé en code**, non lié |
119
+ | `[docs](/home/you/file.md)` (déjà un lien) | **laissé tel quel** |
120
+ | `/home/you/does-not-exist.txt` | non lié, reste en texte brut |
121
+ | `src/app.ts` (relatif) | non lié — un chemin relatif n'est pas résolvable au clic |
122
+
123
+ ## Configuration
124
+
125
+ | Variable | Effet |
126
+ |---|---|
127
+ | `PI_OPEN_DRY=1` | le gestionnaire affiche la commande au lieu d'ouvrir quoi que ce soit |
128
+ | `PI_OPEN_BIN` | chemin du gestionnaire, si vous ne l'avez pas installé dans `~/.local/bin` |
129
+
130
+ Le gestionnaire de fichiers est choisi en tête de `bin/pi-open` (`nautilus` s'il est présent,
131
+ sinon `xdg-open`). Modifiez `FM` pour Thunar, Nemo, Dolphin, …
132
+
133
+ ## Dépannage
134
+
135
+ | Symptôme | Cause / solution |
136
+ |---|---|
137
+ | Aucun style de lien, même sur les URL `https://` | `terminal.hyperlinks` est désactivé : relancez `./install.sh`, redémarrez pi |
138
+ | Le lien est stylé mais le clic ne fait rien | le terminal ne peut pas ouvrir le schéma : vérifiez `xdg-mime query default x-scheme-handler/pi-open` |
139
+ | Le clic ouvre un éditeur au lieu du dossier | c'est un lien `file://` rendu par pi (chemins des sorties d'outils), qui contourne ce gestionnaire ; cliquez le chemin dans le texte de l'assistant |
140
+ | Rien ne se passe sur les chemins avec espaces | le chemin doit exister au moment du rendu : l'extension ne lie que les chemins absolus existants |
141
+ | `pi-open: command not found` | lancez `./install.sh` (étape 2) |
142
+ | Le mode plein écran avale les clics | maintenez `Ctrl+Shift` en cliquant pour utiliser la gestion native des liens du terminal |
143
+
144
+ Lancez le gestionnaire directement pour déboguer :
145
+
146
+ ```bash
147
+ PI_OPEN_DRY=1 ~/.local/bin/pi-open 'pi-open://open?p=/home/you/Desktop'
148
+ ```
149
+
150
+ ## Tests
151
+
152
+ ```bash
153
+ npm test # node >= 22 : TypeScript est retiré nativement
154
+ ```
155
+
156
+ - `test/linkify.mjs` — transformateur Markdown (chemins, blocs de code, espaces, CJK, suffixes `:ligne`)
157
+ - `test/setup.mjs` — chemin d'auto-installation, dans un `$HOME` jetable
158
+
159
+ ## Désinstallation
160
+
161
+ ```bash
162
+ ./uninstall.sh
163
+ pi remove git:github.com/bbjson/pi-clickable-links
164
+ # éventuellement remettre terminal.hyperlinks dans ~/.pi/agent/settings.json
165
+ ```
166
+
167
+ ## Licence
168
+
169
+ MIT — voir [LICENSE](LICENSE).