Compare commits
@@ -41,31 +41,14 @@ jobs:
|
|||||||
cache: npm
|
cache: npm
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
# @arboretum/shared (dépendance runtime non publiée) est embarquée dans le tarball
|
# @arboretum/shared est une dépendance runtime non publiée : on packe les
|
||||||
# via bundleDependencies (matérialisée au prepack). On packe donc UN SEUL tarball
|
# deux tarballs et on les installe ensemble dans un projet vierge.
|
||||||
# et on l'installe seul, comme un vrai consommateur depuis le registre.
|
- name: Pack tarballs
|
||||||
- name: Pack tarball
|
|
||||||
run: |
|
run: |
|
||||||
rm -rf /tmp/tarballs && mkdir -p /tmp/tarballs
|
mkdir -p /tmp/tarballs
|
||||||
# Le hook prepack (copy-web + vendor-shared + copy-meta) matérialise
|
npm pack -w @arboretum/shared -w git-arboretum --pack-destination /tmp/tarballs
|
||||||
# @arboretum/shared comme VRAI dossier dans le node_modules du serveur —
|
|
||||||
# condition pour que npm l'embarque via bundleDependencies. Selon la version
|
|
||||||
# de npm du runner, « npm pack -w » ne déclenche PAS toujours ce lifecycle
|
|
||||||
# (contrairement à « npm publish -w », qui lance bien prepack). On l'exécute
|
|
||||||
# donc explicitement, on vérifie la matérialisation, puis on packe avec
|
|
||||||
# --ignore-scripts (prepack déjà fait, dossier physique présent → bundlé).
|
|
||||||
npm run prepack -w @johanleroy/git-arboretum
|
|
||||||
test -f packages/server/node_modules/@arboretum/shared/dist/index.js \
|
|
||||||
|| { echo "ERREUR: prepack n'a pas matérialisé @arboretum/shared/dist/index.js"; exit 1; }
|
|
||||||
npm pack -w @johanleroy/git-arboretum --pack-destination /tmp/tarballs --ignore-scripts
|
|
||||||
ls -l /tmp/tarballs
|
ls -l /tmp/tarballs
|
||||||
- name: Assert @arboretum/shared is bundled in the tarball
|
- name: Install tarballs in an empty project
|
||||||
run: |
|
|
||||||
tgz=$(ls /tmp/tarballs/*.tgz)
|
|
||||||
tar -tzf "$tgz" | grep -q 'node_modules/@arboretum/shared/dist/index.js' \
|
|
||||||
|| { echo "ERREUR: @arboretum/shared non embarqué dans $tgz"; exit 1; }
|
|
||||||
echo "OK: bundleDependency @arboretum/shared présente dans $tgz"
|
|
||||||
- name: Install tarball in an empty project
|
|
||||||
run: |
|
run: |
|
||||||
mkdir /tmp/smoke
|
mkdir /tmp/smoke
|
||||||
cd /tmp/smoke
|
cd /tmp/smoke
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
# Publication du paquet @johanleroy/git-arboretum sur le registre npm du Gitea,
|
|
||||||
# déclenchée UNIQUEMENT par un tag vX.Y.Z (jamais sur un push de branche).
|
|
||||||
name: Release
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags: ['v*']
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
name: Publish to Gitea npm registry
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 22
|
|
||||||
registry-url: 'https://git.lidge.fr/api/packages/johanleroy/npm/'
|
|
||||||
scope: '@johanleroy'
|
|
||||||
cache: npm
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm run build
|
|
||||||
# Garde-fou : le tag (sans le "v") doit correspondre à la version du paquet.
|
|
||||||
# GITHUB_REF_NAME est une variable d'env du runner (pas d'interpolation ${{ }} dans le shell).
|
|
||||||
- name: Verify tag matches package version
|
|
||||||
run: |
|
|
||||||
pkg=$(node -p "require('./packages/server/package.json').version")
|
|
||||||
tag="${GITHUB_REF_NAME#v}"
|
|
||||||
if [ "$pkg" != "$tag" ]; then
|
|
||||||
echo "ERREUR: tag '$tag' != version paquet '$pkg'"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
echo "OK: tag $tag == version $pkg"
|
|
||||||
- run: npm publish -w @johanleroy/git-arboretum
|
|
||||||
env:
|
|
||||||
# Mapper le secret du registre (PAT Gitea write:package, ou le token auto
|
|
||||||
# GITEA_TOKEN s'il a ce scope) sur NODE_AUTH_TOKEN lu par le .npmrc de setup-node.
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
||||||
@@ -5,11 +5,6 @@ node_modules/
|
|||||||
dist/
|
dist/
|
||||||
packages/server/public/
|
packages/server/public/
|
||||||
*.tgz
|
*.tgz
|
||||||
*.tsbuildinfo
|
|
||||||
|
|
||||||
# README/LICENSE copiés dans le paquet au prepack (générés depuis la racine)
|
|
||||||
packages/server/README.md
|
|
||||||
packages/server/LICENSE
|
|
||||||
|
|
||||||
# Test / coverage
|
# Test / coverage
|
||||||
coverage/
|
coverage/
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# Route le scope @johanleroy vers le registre npm intégré du Gitea self-hosted.
|
|
||||||
# Les dépendances publiques (fastify, node-pty…) restent résolues depuis npmjs.
|
|
||||||
# Le token d'auth (_authToken) ne se commit JAMAIS : il vit dans ~/.npmrc (local)
|
|
||||||
# ou dans un secret CI (NODE_AUTH_TOKEN écrit par setup-node).
|
|
||||||
@johanleroy:registry=https://git.lidge.fr/api/packages/johanleroy/npm/
|
|
||||||
@@ -1,256 +0,0 @@
|
|||||||
<p align="center">
|
|
||||||
<img src="brand/arboretum-logo-on-dark.png" alt="Arboretum" width="300">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
Un dashboard web auto-hébergé pour vos worktrees git et les sessions Claude Code qui tournent dessus — depuis n'importe quel appareil.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<a href="README.md">English</a> · <strong>Français</strong>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
**Statut : MVP.** Le dashboard worktree-first, la découverte et la reprise de sessions, le cycle de vie des worktrees multi-repo, les états de session en temps réel, le terminal web, la supervision mobile (PWA installable, Web Push quand une session vous attend, valider/refuser sans ouvrir de terminal) et les groupes de travail (piloter plusieurs repos liés à la fois) sont implémentés et testés.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Le problème
|
|
||||||
|
|
||||||
Travailler avec des agents de code IA a changé notre usage de git : une feature = un worktree = une session Claude Code, plusieurs en parallèle. Mais l'outillage n'a pas suivi :
|
|
||||||
|
|
||||||
- `git worktree list` sur plusieurs repos est fastidieux, les worktrees s'accumulent, chacun a besoin de ses `node_modules` et `.env`.
|
|
||||||
- Les sessions Claude Code sont éparpillées : certaines tournent dans des terminaux, d'autres sont reprenables depuis l'historique, sans vue consolidée de *celle qui attend votre intervention*.
|
|
||||||
- Quand vous vous éloignez de votre poste, une session bloquée sur une demande de permission reste bloquée.
|
|
||||||
|
|
||||||
## Ce que fait Arboretum
|
|
||||||
|
|
||||||
Un unique daemon Node.js que vous lancez sur votre machine de dev (`npx @johanleroy/git-arboretum`), servant une interface web utilisable depuis votre ordinateur, téléphone ou tablette :
|
|
||||||
|
|
||||||
- **Dashboard worktree-first, multi-repo** — chaque worktree de chaque repo enregistré, avec son état git (branche, ahead/behind, fichiers modifiés) *et* l'état de sa session Claude Code (busy / en attente d'entrée / idle / reprenable).
|
|
||||||
- **Cycle de vie complet des worktrees** — créer (avec des hooks post-création par repo : `npm ci`, copie de `.env`…), adopter des worktrees créés à la main, supprimer avec garde-fous, élaguer les orphelins.
|
|
||||||
- **Découverte & reprise de sessions** — les sessions lancées dans votre propre terminal apparaissent automatiquement ; reprenez les sessions mortes, observez ou forkez les vivantes. Ne corrompt jamais une session vivante.
|
|
||||||
- **Terminal web** — terminal xterm.js complet vers chaque session managée, qui survit aux déconnexions du navigateur.
|
|
||||||
- **Supervision depuis votre téléphone** — PWA installable avec notifications push quand une session vous attend ; validez ou refusez une demande sans ouvrir de terminal.
|
|
||||||
- **Groupes de travail** — regroupez des repos liés (ex. une API, son frontend web et une lib partagée) dans un groupe nommé pour travailler sur tous à la fois : une vue unifiée de leurs worktrees et sessions, une grille multi-terminaux côte à côte, et une action « feature cross-repo » en un clic qui crée le même worktree de branche (et au besoin une session Claude) dans chaque repo du groupe.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Prérequis
|
|
||||||
|
|
||||||
- **Node.js ≥ 22.16** — requis, pas seulement recommandé. Arboretum persiste son état avec `node:sqlite` (`DatabaseSync`), natif et stable seulement à partir de cette version. (`.nvmrc` fixe `22`.)
|
|
||||||
- **Le CLI `claude`** sur votre `PATH` si vous voulez qu'Arboretum lance et gère des sessions Claude Code. Arboretum enveloppe le CLI interactif que vous utilisez déjà — installez-le et authentifiez-le comme d'habitude.
|
|
||||||
- Un **dépôt git** (ou plusieurs) que vous voulez gérer.
|
|
||||||
|
|
||||||
## Démarrage rapide
|
|
||||||
|
|
||||||
Deux chemins, selon ce que vous voulez :
|
|
||||||
|
|
||||||
- **Juste l'utiliser (la plupart des gens).** Arboretum est un paquet npm publié — vous **n'avez pas besoin de cloner ce dépôt**. Pointez npm vers le registre et lancez-le (ci-dessous). À faire sur la machine où tournent vos sessions Claude Code.
|
|
||||||
- **Lancer depuis les sources.** Ne clonez le dépôt que pour développer Arboretum ou lancer une version non publiée.
|
|
||||||
|
|
||||||
### Le lancer (recommandé)
|
|
||||||
|
|
||||||
Arboretum est publié sur un registre npm Gitea auto-hébergé. Pointez le scope `@johanleroy` dessus une fois par machine — ajoutez à `~/.npmrc` :
|
|
||||||
|
|
||||||
```
|
|
||||||
@johanleroy:registry=https://git.lidge.fr/api/packages/johanleroy/npm/
|
|
||||||
```
|
|
||||||
|
|
||||||
Aucun token nécessaire — le paquet est en lecture publique. Puis lancez-le depuis n'importe où :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx @johanleroy/git-arboretum
|
|
||||||
```
|
|
||||||
|
|
||||||
Au premier démarrage, Arboretum affiche un **token d'accès** unique et l'URL à ouvrir :
|
|
||||||
|
|
||||||
```
|
|
||||||
┌──────────────────────────────────────────────────────────────────┐
|
|
||||||
│ First start — your access token (shown once, store it safely): │
|
|
||||||
└──────────────────────────────────────────────────────────────────┘
|
|
||||||
|
|
||||||
<votre-token-ici>
|
|
||||||
|
|
||||||
Login at: http://127.0.0.1:7317/
|
|
||||||
```
|
|
||||||
|
|
||||||
Ouvrez l'URL, collez le token pour vous connecter, et c'est parti. Le token est stocké **hashé** — il n'est affiché qu'une seule fois, alors gardez-le en lieu sûr (un gestionnaire de mots de passe). Vous pourrez gérer vos tokens plus tard depuis les **Réglages**.
|
|
||||||
|
|
||||||
`npx` télécharge et lance la dernière version publiée à chaque fois. Pour l'installer une bonne fois — et obtenir la commande `arboretum` sur votre `PATH`, dont se sert le [service d'arrière-plan](#le-faire-tourner-en-service-darrière-plan) —, installez-le plutôt globalement :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm i -g @johanleroy/git-arboretum
|
|
||||||
arboretum # identique à la commande npx, depuis le binaire installé
|
|
||||||
```
|
|
||||||
|
|
||||||
### Lancer depuis les sources
|
|
||||||
|
|
||||||
Nécessaire uniquement pour **développer** Arboretum ou lancer une version non publiée — pas pour simplement l'utiliser. Clonez le dépôt, installez les dépendances, buildez, puis démarrez le daemon :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://git.lidge.fr/johanleroy/arboretum.git
|
|
||||||
cd arboretum
|
|
||||||
nvm use # ou assurez-vous d'avoir Node ≥ 22.16
|
|
||||||
npm install
|
|
||||||
npm run build # build shared → server → web (l'ordre compte)
|
|
||||||
node packages/server/dist/index.js
|
|
||||||
```
|
|
||||||
|
|
||||||
## Utiliser Arboretum
|
|
||||||
|
|
||||||
1. **Ajoutez un dépôt.** Depuis le dashboard, enregistrez un repo git local par son chemin. Configurez éventuellement des **hooks post-création** (ex. `npm ci`, `cp ../.env .env`) exécutés automatiquement à chaque création d'un nouveau worktree pour ce repo.
|
|
||||||
2. **Créez ou adoptez des worktrees.** Créez un nouveau worktree + branche en un clic (les hooks s'exécutent pour vous), ou adoptez un worktree créé à la main. Chaque worktree affiche sa branche, son ahead/behind et son nombre de fichiers modifiés.
|
|
||||||
3. **Démarrez ou reprenez une session.** Lancez une session Claude Code sur un worktree, ou reprenez-en une démarrée dans votre terminal — Arboretum découvre les sessions existantes automatiquement et les reprend toujours dans leur répertoire de travail d'origine.
|
|
||||||
4. **Suivez les états en direct.** Chaque session indique si elle est *busy*, *en attente de votre entrée* ou *idle*. Ouvrez le **terminal web** pour interagir directement ; il survit aux déconnexions du navigateur (fermer l'onglet ne tue pas la session).
|
|
||||||
5. **Supervisez depuis votre téléphone.** Installez la PWA, et quand une session bascule en *attente*, vous recevez une notification push. Validez ou refusez la demande directement depuis l'interface de notification — sans terminal.
|
|
||||||
|
|
||||||
## Accès distant depuis votre téléphone
|
|
||||||
|
|
||||||
Arboretum se bind sur `127.0.0.1` par défaut et **refuse** de se binder sur une adresse non-loopback sans dérogation explicite. La façon recommandée (et sûre) de l'atteindre depuis d'autres appareils est **[Tailscale Serve](https://tailscale.com/kb/1242/tailscale-serve)** — HTTPS valide, identité tailnet, aucun port ouvert :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Expose le daemon local en HTTPS dans votre tailnet
|
|
||||||
tailscale serve --bg 7317
|
|
||||||
```
|
|
||||||
|
|
||||||
Puis démarrez Arboretum en autorisant l'origine de votre tailnet (le check Origin strict doit la connaître) :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx @johanleroy/git-arboretum --allow-origin https://<machine>.<tailnet>.ts.net
|
|
||||||
```
|
|
||||||
|
|
||||||
Ouvrez `https://<machine>.<tailnet>.ts.net` depuis n'importe quel appareil de votre tailnet. **Web Push exige HTTPS**, donc Tailscale Serve (ou un autre front HTTPS) est aussi ce qui active les notifications mobiles. Sur **iOS**, installez d'abord l'app à l'écran d'accueil, puis autorisez les notifications.
|
|
||||||
|
|
||||||
> ⚠️ Un terminal web, c'est de l'exécution de code à distance **par conception**. N'exposez jamais Arboretum directement sur l'internet public.
|
|
||||||
|
|
||||||
## Le faire tourner en service d'arrière-plan
|
|
||||||
|
|
||||||
Le plus rapide pour faire tourner Arboretum en service qui survit à la déconnexion et redémarre au boot, c'est l'installeur intégré. Installez une version figée globalement, puis lancez `install` — il détecte votre OS, écrit le fichier de service, le démarre et affiche le token unique :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm i -g @johanleroy/git-arboretum
|
|
||||||
arboretum install --allow-origin https://MACHINE.TAILNET.ts.net
|
|
||||||
```
|
|
||||||
|
|
||||||
Cela met en place un **service systemd utilisateur** sous Linux (`~/.config/systemd/user/arboretum.service`) ou un **LaunchAgent launchd** sous macOS (`~/Library/LaunchAgents/fr.lidge.arboretum.plist`). Tous les flags du daemon (`--port`, `--allow-origin`, `--db`, …) sont propagés au service. Gérez-le avec :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
arboretum status # état du service (+ où lire les logs)
|
|
||||||
arboretum uninstall # arrête et supprime le service
|
|
||||||
```
|
|
||||||
|
|
||||||
Les logs vivent dans `journalctl --user -u arboretum -f` (Linux) ou `~/Library/Logs/arboretum/` (macOS). Lancez d'abord `arboretum install --dry-run …` pour afficher le unit/plist et les commandes exactes sans rien modifier.
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Vous préférez configurer systemd à la main ? (Linux)</summary>
|
|
||||||
|
|
||||||
Créez `~/.config/systemd/user/arboretum.service` :
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[Unit]
|
|
||||||
Description=Arboretum — git worktree & Claude Code dashboard
|
|
||||||
After=network-online.target
|
|
||||||
Wants=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=%h/.local/bin/arboretum --port 7317 --allow-origin https://MACHINE.TAILNET.ts.net
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=5
|
|
||||||
KillSignal=SIGTERM
|
|
||||||
TimeoutStopSec=10
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
which arboretum # ajustez ExecStart au vrai chemin si besoin
|
|
||||||
systemctl --user daemon-reload
|
|
||||||
systemctl --user enable --now arboretum
|
|
||||||
loginctl enable-linger "$USER" # démarre le service au boot, sans session ouverte
|
|
||||||
journalctl --user -u arboretum -f # logs
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
> Le **token d'accès** unique est affiché par `arboretum install` (et au tout premier lancement manuel sur base vierge). Le token est hashé et n'est jamais réaffiché — conservez-le en lieu sûr.
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
Commandes : `arboretum` démarre le daemon (par défaut), `arboretum serve` en est un alias explicite, `arboretum install` / `uninstall` / `status` gèrent le service d'arrière-plan, et `arboretum help` affiche l'aide.
|
|
||||||
|
|
||||||
Les options du daemon sont des flags CLI :
|
|
||||||
|
|
||||||
| Flag | Défaut | Description |
|
|
||||||
|---|---|---|
|
|
||||||
| `--port <n>` | `7317` | Port d'écoute. |
|
|
||||||
| `--bind <addr>` | `127.0.0.1` | Adresse de bind. Une adresse non-loopback est refusée sauf si `--i-know-this-exposes-a-terminal` est défini. |
|
|
||||||
| `--allow-origin <url>` | — | Origine `Origin` autorisée supplémentaire (répétable). Nécessaire pour l'accès Tailscale/HTTPS. |
|
|
||||||
| `--db <path>` | `<data>/arboretum.db` | Chemin de la base SQLite. |
|
|
||||||
| `--vapid-contact <mailto/url>` | `mailto:arboretum@localhost` | Sujet de contact VAPID pour le Web Push. |
|
|
||||||
| `--print-token` | `false` | Indication sur le réaffichage du token (les tokens sont hashés et ne peuvent pas être réaffichés). |
|
|
||||||
| `--i-know-this-exposes-a-terminal` | `false` | Reconnaître le bind sur une adresse non-loopback. **À éviter** — préférez Tailscale Serve. |
|
|
||||||
|
|
||||||
`arboretum install` accepte tous les flags du daemon ci-dessus (propagés tels quels au service), plus :
|
|
||||||
|
|
||||||
| Flag | Description |
|
|
||||||
|---|---|
|
|
||||||
| `--bin-path <path>` | Utilise ce binaire dans le service au lieu de `node` + le script embarqué. |
|
|
||||||
| `--label <id>` | Label launchd (macOS uniquement, défaut `fr.lidge.arboretum`). |
|
|
||||||
| `--dry-run` | Affiche le unit/plist et les commandes sans rien appliquer. |
|
|
||||||
| `--no-enable` | Écrit le fichier de service sans l'activer/le démarrer. |
|
|
||||||
|
|
||||||
L'état (la base SQLite) vit dans `$XDG_DATA_HOME/arboretum` (par défaut `~/.local/share/arboretum`).
|
|
||||||
|
|
||||||
## Modèle de sécurité
|
|
||||||
|
|
||||||
Un terminal web, c'est de l'exécution de code à distance *par conception*. Les garde-fous d'Arboretum sont structurants :
|
|
||||||
|
|
||||||
- Se bind sur `127.0.0.1` par défaut ; refuse les binds non-loopback sans flag explicite.
|
|
||||||
- Authentifie **chaque** requête `/api/**` **et** chaque upgrade `/ws` avec des tokens révocables, et applique un **check `Origin` strict** (le cookie `SameSite=Strict` ne couvre pas les upgrades WebSocket — c'est le garde-fou anti cross-site hijacking).
|
|
||||||
- Les tokens sont stockés **hashés** (sha256) et comparés en temps constant ; le bootstrap token n'est affiché qu'une seule fois. Le cookie de session est un payload signé HMAC, `HttpOnly` et `SameSite=Strict`, et reçoit automatiquement le flag `Secure` quand la requête arrive en HTTPS (p. ex. derrière Tailscale Serve). Le login est rate-limité avec backoff exponentiel.
|
|
||||||
|
|
||||||
Tailscale Serve est **la** façon d'atteindre Arboretum depuis d'autres appareils — pas seulement une recommandation : HTTPS valide, identité tailnet, aucun port ouvert. Le flag `--i-know-this-exposes-a-terminal` est une trappe de secours, pas un mode de déploiement ; n'exposez jamais Arboretum directement sur internet.
|
|
||||||
|
|
||||||
## Ce qui le distingue
|
|
||||||
|
|
||||||
| | Arboretum | GitKraken Agent Mode / Conductor / Nimbalyst | Happy / CloudCLI | Anthropic Remote Control |
|
|
||||||
|---|---|---|---|---|
|
|
||||||
| Interface web, tout appareil | ✅ | ❌ apps desktop | ✅ | ✅ |
|
|
||||||
| Gestion visuelle des worktrees (multi-repo) | ✅ | ✅ (mono-repo, desktop) | ❌ | ❌ |
|
|
||||||
| Découvre & reprend les sessions de terminal *existantes* | ✅ | ❌ | partiel | ❌ |
|
|
||||||
| 100 % auto-hébergé — zéro trafic via des serveurs tiers | ✅ | ✅ | serveur relais | ❌ relayé via Anthropic |
|
|
||||||
| Linux-first | ✅ | variable | ✅ | l'app desktop n'a pas de build Linux |
|
|
||||||
| Open source | MIT | ❌ / partiel | MIT / AGPL | ❌ |
|
|
||||||
|
|
||||||
Le Remote Control d'Anthropic est excellent pour piloter *une* session depuis votre téléphone. Arboretum est la couche qu'il ne fournit pas : le tableau consolidé et auto-hébergé de tous vos worktrees et sessions, à travers tous vos repos.
|
|
||||||
|
|
||||||
## Une note sur l'usage de Claude
|
|
||||||
|
|
||||||
Arboretum enveloppe le CLI Claude Code **interactif** dans un PTY — la même chose que vous lancez dans votre terminal, affichée dans votre navigateur. Il n'utilise pas l'Agent SDK ni le mode headless. Les politiques d'usage d'Anthropic autour de l'usage programmatique peuvent évoluer ; Arboretum suivra les sorties du CLI et documentera tout impact de façon transparente.
|
|
||||||
|
|
||||||
## Développement
|
|
||||||
|
|
||||||
Arboretum est un monorepo npm workspaces : `@arboretum/shared` (protocole WS/REST, source de vérité), `@johanleroy/git-arboretum` (le daemon Fastify, le paquet publié) et `@arboretum/web` (la SPA Vue 3).
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run build # build shared → server → web (l'ordre compte)
|
|
||||||
npm run typecheck # tsc -b shared + server
|
|
||||||
npm test # vitest sur les packages
|
|
||||||
npm run dev:server # daemon en watch
|
|
||||||
npm run dev:web # serveur de dev Vite (proxifie /api et /ws vers le daemon sur :7317)
|
|
||||||
```
|
|
||||||
|
|
||||||
Scripts d'acceptation end-to-end (lancez `npm run build` d'abord) :
|
|
||||||
|
|
||||||
```bash
|
|
||||||
node packages/server/scripts/acceptance-p1.mjs # cœur : daemon + client WS réel
|
|
||||||
node packages/server/scripts/acceptance-p2.mjs # découverte & reprise de sessions
|
|
||||||
node packages/server/scripts/acceptance-p3.mjs # worktrees & corrélation de sessions
|
|
||||||
node packages/server/scripts/acceptance-p4.mjs # Web Push + commande WS `answer`
|
|
||||||
node packages/server/scripts/acceptance-p5.mjs # groupes de travail : CRUD + broadcast WS + CASCADE
|
|
||||||
```
|
|
||||||
|
|
||||||
## Licence
|
|
||||||
|
|
||||||
MIT — voir [LICENSE](LICENSE).
|
|
||||||
@@ -1,16 +1,8 @@
|
|||||||
<p align="center">
|
# Arboretum
|
||||||
<img src="brand/arboretum-logo-on-dark.png" alt="Arboretum" width="300">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
> A self-hosted web dashboard for your git worktrees and the Claude Code sessions running on them — from any device.
|
||||||
A self-hosted web dashboard for your git worktrees and the Claude Code sessions running on them — from any device.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
**Status: MVP.** The worktree-first dashboard, session discovery & resume, multi-repo worktree lifecycle, live session states, the web terminal, and mobile supervision (installable PWA, Web Push when a session needs you, approve/deny without opening a terminal) are implemented and tested.
|
||||||
<strong>English</strong> · <a href="README.fr.md">Français</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
**Status: MVP.** The worktree-first dashboard, session discovery & resume, multi-repo worktree lifecycle, live session states, the web terminal, and mobile supervision (installable PWA, Web Push when a session needs you, approve/deny without opening a terminal), and work groups (run several related repos at once) are implemented and tested.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -24,14 +16,13 @@ Working with AI coding agents changed how we use git: one feature = one worktree
|
|||||||
|
|
||||||
## What Arboretum does
|
## What Arboretum does
|
||||||
|
|
||||||
A single Node.js daemon you run on your dev machine (`npx @johanleroy/git-arboretum`), serving a web UI usable from your desktop, phone or tablet:
|
A single Node.js daemon you run on your dev machine (`npx git-arboretum`), serving a web UI usable from your desktop, phone or tablet:
|
||||||
|
|
||||||
- **Worktree-first, multi-repo dashboard** — every worktree of every registered repo, with its git state (branch, ahead/behind, dirty files) *and* the state of its Claude Code session (busy / waiting for input / idle / resumable).
|
- **Worktree-first, multi-repo dashboard** — every worktree of every registered repo, with its git state (branch, ahead/behind, dirty files) *and* the state of its Claude Code session (busy / waiting for input / idle / resumable).
|
||||||
- **Full worktree lifecycle** — create (with per-repo post-create hooks: `npm ci`, copy `.env`…), adopt worktrees created by hand, delete with guardrails, prune orphans.
|
- **Full worktree lifecycle** — create (with per-repo post-create hooks: `npm ci`, copy `.env`…), adopt worktrees created by hand, delete with guardrails, prune orphans.
|
||||||
- **Session discovery & resume** — sessions you launched in your own terminal show up automatically; resume dead ones, observe or fork live ones. Never corrupts a live session.
|
- **Session discovery & resume** — sessions you launched in your own terminal show up automatically; resume dead ones, observe or fork live ones. Never corrupts a live session.
|
||||||
- **Web terminal** — full xterm.js terminal to every managed session, surviving browser disconnects.
|
- **Web terminal** — full xterm.js terminal to every managed session, surviving browser disconnects.
|
||||||
- **Supervision from your phone** — installable PWA with push notifications when a session needs you; approve/deny a prompt without opening a terminal.
|
- **Supervision from your phone** — installable PWA with push notifications when a session needs you; approve/deny a prompt without opening a terminal.
|
||||||
- **Work groups** — bundle related repos (e.g. an API, its web frontend and a shared library) into a named group to work on them at once: a unified view of all their worktrees and sessions, a side-by-side multi-terminal grid, and a one-click "cross-repo feature" that creates the same branch worktree (and optionally a Claude session) across every repo in the group.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -43,23 +34,10 @@ A single Node.js daemon you run on your dev machine (`npx @johanleroy/git-arbore
|
|||||||
|
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
Two paths, depending on what you want:
|
|
||||||
|
|
||||||
- **Just use it (most people).** Arboretum is a published npm package — you **don't need to clone this repo**. Point npm at the registry and run it (below). Do this on the machine where your Claude Code sessions run.
|
|
||||||
- **Run from source.** Clone the repo only to hack on Arboretum or run an unreleased build.
|
|
||||||
|
|
||||||
### Run it (recommended)
|
### Run it (recommended)
|
||||||
|
|
||||||
Arboretum is published to a self-hosted Gitea npm registry. Point the `@johanleroy` scope at it once per machine — add to `~/.npmrc`:
|
|
||||||
|
|
||||||
```
|
|
||||||
@johanleroy:registry=https://git.lidge.fr/api/packages/johanleroy/npm/
|
|
||||||
```
|
|
||||||
|
|
||||||
No token needed — the package is publicly readable. Then run it from anywhere:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx @johanleroy/git-arboretum
|
npx git-arboretum
|
||||||
```
|
```
|
||||||
|
|
||||||
On first start, Arboretum prints a one-time **access token** and the URL to open:
|
On first start, Arboretum prints a one-time **access token** and the URL to open:
|
||||||
@@ -76,17 +54,8 @@ On first start, Arboretum prints a one-time **access token** and the URL to open
|
|||||||
|
|
||||||
Open the URL, paste the token to log in, and you're in. The token is stored **hashed** — it is shown only once, so save it somewhere safe (a password manager). You can manage tokens later from **Settings**.
|
Open the URL, paste the token to log in, and you're in. The token is stored **hashed** — it is shown only once, so save it somewhere safe (a password manager). You can manage tokens later from **Settings**.
|
||||||
|
|
||||||
`npx` fetches and runs the latest published version each time. To install it once — and get the `arboretum` command on your `PATH`, which the [background service](#running-it-as-a-background-service) relies on — install it globally instead:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm i -g @johanleroy/git-arboretum
|
|
||||||
arboretum # identical to the npx command, from the installed binary
|
|
||||||
```
|
|
||||||
|
|
||||||
### Run from source
|
### Run from source
|
||||||
|
|
||||||
Only needed to **develop** Arboretum or run an unreleased build — not required just to use it. Clone the repo, install dependencies, build, then start the daemon:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://git.lidge.fr/johanleroy/arboretum.git
|
git clone https://git.lidge.fr/johanleroy/arboretum.git
|
||||||
cd arboretum
|
cd arboretum
|
||||||
@@ -116,70 +85,16 @@ tailscale serve --bg 7317
|
|||||||
Then start Arboretum allowing your tailnet origin (the strict Origin check needs to know about it):
|
Then start Arboretum allowing your tailnet origin (the strict Origin check needs to know about it):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npx @johanleroy/git-arboretum --allow-origin https://<machine>.<tailnet>.ts.net
|
npx git-arboretum --allow-origin https://<machine>.<tailnet>.ts.net
|
||||||
```
|
```
|
||||||
|
|
||||||
Open `https://<machine>.<tailnet>.ts.net` from any device on your tailnet. **Web Push requires HTTPS**, so Tailscale Serve (or another HTTPS front) is also what enables mobile notifications. On **iOS**, install the app to your home screen first, then allow notifications.
|
Open `https://<machine>.<tailnet>.ts.net` from any device on your tailnet. **Web Push requires HTTPS**, so Tailscale Serve (or another HTTPS front) is also what enables mobile notifications. On **iOS**, install the app to your home screen first, then allow notifications.
|
||||||
|
|
||||||
> ⚠️ A web terminal is remote code execution **by design**. Never expose Arboretum directly to the public internet.
|
> ⚠️ A web terminal is remote code execution **by design**. Never expose Arboretum directly to the public internet.
|
||||||
|
|
||||||
## Running it as a background service
|
|
||||||
|
|
||||||
The quickest way to run Arboretum as a service that survives logout and restarts on boot is the built-in installer. Install a pinned version globally, then run `install` — it detects your OS, writes the service file, starts it, and prints the one-time token:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npm i -g @johanleroy/git-arboretum
|
|
||||||
arboretum install --allow-origin https://MACHINE.TAILNET.ts.net
|
|
||||||
```
|
|
||||||
|
|
||||||
This sets up a **systemd user service** on Linux (`~/.config/systemd/user/arboretum.service`) or a **launchd LaunchAgent** on macOS (`~/Library/LaunchAgents/fr.lidge.arboretum.plist`). Every daemon flag (`--port`, `--allow-origin`, `--db`, …) is propagated to the service. Manage it with:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
arboretum status # service status (+ where to read logs)
|
|
||||||
arboretum uninstall # stop and remove the service
|
|
||||||
```
|
|
||||||
|
|
||||||
Logs live in `journalctl --user -u arboretum -f` (Linux) or `~/Library/Logs/arboretum/` (macOS). Run `arboretum install --dry-run …` first to print the unit/plist and the exact commands without touching anything.
|
|
||||||
|
|
||||||
<details>
|
|
||||||
<summary>Prefer to set up systemd by hand? (Linux)</summary>
|
|
||||||
|
|
||||||
Create `~/.config/systemd/user/arboretum.service`:
|
|
||||||
|
|
||||||
```ini
|
|
||||||
[Unit]
|
|
||||||
Description=Arboretum — git worktree & Claude Code dashboard
|
|
||||||
After=network-online.target
|
|
||||||
Wants=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=%h/.local/bin/arboretum --port 7317 --allow-origin https://MACHINE.TAILNET.ts.net
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=5
|
|
||||||
KillSignal=SIGTERM
|
|
||||||
TimeoutStopSec=10
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
which arboretum # adjust ExecStart to the real path if needed
|
|
||||||
systemctl --user daemon-reload
|
|
||||||
systemctl --user enable --now arboretum
|
|
||||||
loginctl enable-linger "$USER" # start the service at boot, without an open session
|
|
||||||
journalctl --user -u arboretum -f # logs
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
|
|
||||||
> The one-time **access token is printed by `arboretum install`** (and on the very first manual run with an empty database). The token is hashed and never shown again — store it safely.
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Commands: `arboretum` starts the daemon (the default), `arboretum serve` is an explicit alias, `arboretum install` / `uninstall` / `status` manage the background service, and `arboretum help` prints usage.
|
All options are CLI flags:
|
||||||
|
|
||||||
Daemon options are CLI flags:
|
|
||||||
|
|
||||||
| Flag | Default | Description |
|
| Flag | Default | Description |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
@@ -191,15 +106,6 @@ Daemon options are CLI flags:
|
|||||||
| `--print-token` | `false` | Hint about token re-printing (tokens are hashed and cannot be re-shown). |
|
| `--print-token` | `false` | Hint about token re-printing (tokens are hashed and cannot be re-shown). |
|
||||||
| `--i-know-this-exposes-a-terminal` | `false` | Acknowledge binding to a non-loopback address. **Avoid** — prefer Tailscale Serve. |
|
| `--i-know-this-exposes-a-terminal` | `false` | Acknowledge binding to a non-loopback address. **Avoid** — prefer Tailscale Serve. |
|
||||||
|
|
||||||
`arboretum install` accepts every daemon flag above (propagated verbatim to the service) plus:
|
|
||||||
|
|
||||||
| Flag | Description |
|
|
||||||
|---|---|
|
|
||||||
| `--bin-path <path>` | Use this binary in the service instead of `node` + the bundled script. |
|
|
||||||
| `--label <id>` | launchd label (macOS only, default `fr.lidge.arboretum`). |
|
|
||||||
| `--dry-run` | Print the unit/plist and commands without applying anything. |
|
|
||||||
| `--no-enable` | Write the service file but do not enable/start it. |
|
|
||||||
|
|
||||||
State (the SQLite database) lives in `$XDG_DATA_HOME/arboretum` (default `~/.local/share/arboretum`).
|
State (the SQLite database) lives in `$XDG_DATA_HOME/arboretum` (default `~/.local/share/arboretum`).
|
||||||
|
|
||||||
## Security model
|
## Security model
|
||||||
@@ -208,9 +114,9 @@ A web terminal is remote code execution *by design*. Arboretum's guardrails are
|
|||||||
|
|
||||||
- Binds to `127.0.0.1` by default; refuses non-loopback binds without an explicit flag.
|
- Binds to `127.0.0.1` by default; refuses non-loopback binds without an explicit flag.
|
||||||
- Authenticates **every** `/api/**` request **and** every `/ws` upgrade with revocable tokens, and applies a **strict `Origin` check** (the `SameSite=Strict` cookie does not cover WebSocket upgrades — this is the anti cross-site hijacking guard).
|
- Authenticates **every** `/api/**` request **and** every `/ws` upgrade with revocable tokens, and applies a **strict `Origin` check** (the `SameSite=Strict` cookie does not cover WebSocket upgrades — this is the anti cross-site hijacking guard).
|
||||||
- Tokens are stored **hashed** (sha256) and compared in constant time; the bootstrap token is shown only once. The session cookie is an HMAC-signed payload, `HttpOnly` and `SameSite=Strict`, and it automatically gains the `Secure` flag when the request arrives over HTTPS (e.g. behind Tailscale Serve). Login is rate-limited with exponential backoff.
|
- Tokens are stored **hashed** (sha256) and compared in constant time; the bootstrap token is shown only once. The session cookie is an HMAC-signed payload. Login is rate-limited with exponential backoff.
|
||||||
|
|
||||||
Tailscale Serve is **the** way to reach Arboretum from other devices — not just a recommendation: valid HTTPS, tailnet identity, no open ports. The `--i-know-this-exposes-a-terminal` flag is an escape hatch, not a deployment mode; never expose Arboretum directly to the internet.
|
The recommended way to reach Arboretum from other devices is Tailscale Serve (valid HTTPS, tailnet identity, no open ports). Never expose it directly to the internet.
|
||||||
|
|
||||||
## What makes it different
|
## What makes it different
|
||||||
|
|
||||||
@@ -231,7 +137,7 @@ Arboretum wraps the **interactive** Claude Code CLI in a PTY — the same thing
|
|||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
Arboretum is an npm-workspaces monorepo: `@arboretum/shared` (WS/REST protocol, source of truth), `@johanleroy/git-arboretum` (the Fastify daemon, the published package), and `@arboretum/web` (the Vue 3 SPA).
|
Arboretum is an npm-workspaces monorepo: `@arboretum/shared` (WS/REST protocol, source of truth), `git-arboretum` (the Fastify daemon, the published package), and `@arboretum/web` (the Vue 3 SPA).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm run build # build shared → server → web (order matters)
|
npm run build # build shared → server → web (order matters)
|
||||||
@@ -248,7 +154,6 @@ node packages/server/scripts/acceptance-p1.mjs # core: daemon + real WS client
|
|||||||
node packages/server/scripts/acceptance-p2.mjs # session discovery & resume
|
node packages/server/scripts/acceptance-p2.mjs # session discovery & resume
|
||||||
node packages/server/scripts/acceptance-p3.mjs # worktrees & session correlation
|
node packages/server/scripts/acceptance-p3.mjs # worktrees & session correlation
|
||||||
node packages/server/scripts/acceptance-p4.mjs # Web Push + WS `answer` command
|
node packages/server/scripts/acceptance-p4.mjs # Web Push + WS `answer` command
|
||||||
node packages/server/scripts/acceptance-p5.mjs # work groups: CRUD + WS broadcast + CASCADE
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
# Brand assets
|
|
||||||
|
|
||||||
Logo and icon assets for Arboretum. Source artwork is a neon circuit-tree (green
|
|
||||||
branches, cyan session nodes, a `>_` prompt at the base) on a dark background.
|
|
||||||
|
|
||||||
| File | Use |
|
|
||||||
| --- | --- |
|
|
||||||
| `arboretum-logo-source.png` | Master artwork (opaque dark background). Keep; everything else derives from it. |
|
|
||||||
| `arboretum-logo.png` | Full logo, **transparent**. Best on dark surfaces (the wordmark is light). |
|
|
||||||
| `arboretum-logo-on-dark.png` | Full logo on the app background `#09090b`. Safe on any theme — used in the README. |
|
|
||||||
| `arboretum-mark.png` | Square, **transparent**, tree only (no wordmark). Ideal **Gitea repo avatar** — reads on both light and dark. |
|
|
||||||
|
|
||||||
The transparent versions are extracted by luminance (alpha ∝ brightness), the clean
|
|
||||||
way to lift glow-on-black artwork: the dark background becomes fully transparent, the
|
|
||||||
bright strokes stay opaque, and the glow halos stay semi-transparent so the logo sits
|
|
||||||
correctly on any dark surface.
|
|
||||||
|
|
||||||
## Gitea
|
|
||||||
|
|
||||||
Upload `arboretum-mark.png` as the repository avatar (Settings → uploads a square image;
|
|
||||||
the tree-only mark stays legible at small sizes and works on Gitea's light and dark themes).
|
|
||||||
Use `arboretum-logo.png` (transparent) on dark pages, or `arboretum-logo-on-dark.png`
|
|
||||||
when the surrounding background might be light.
|
|
||||||
|
|
||||||
## App / favicon assets
|
|
||||||
|
|
||||||
The web-facing assets live in `packages/web/public/` and are wired into the SPA:
|
|
||||||
|
|
||||||
- `icon.svg` — scalable favicon, redrawn to match the brand (vector, glow, `>_`).
|
|
||||||
- `icon-192.png` / `icon-512.png` — maskable PWA icons (tree on `#09090b`, content in the safe zone).
|
|
||||||
- `apple-touch-icon.png` — iOS home-screen icon (180×180).
|
|
||||||
- `favicon.ico` — multi-size favicon (16/32/48), transparent.
|
|
||||||
- `logo.png` — transparent full logo for in-app use.
|
|
||||||
|
|
||||||
## Regenerate
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 brand/build-assets.py # uses brand/arboretum-logo-source.png
|
|
||||||
python3 brand/build-assets.py other.png # or pass another source
|
|
||||||
```
|
|
||||||
|
|
||||||
Requires Python with Pillow + numpy. Writes both `brand/` and `packages/web/public/`.
|
|
||||||
|
Before Width: | Height: | Size: 227 KiB |
|
Before Width: | Height: | Size: 959 KiB |
|
Before Width: | Height: | Size: 561 KiB |
|
Before Width: | Height: | Size: 184 KiB |
@@ -1,100 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
"""Génère le jeu complet d'assets de marque Arboretum depuis le logo source.
|
|
||||||
|
|
||||||
Source : un PNG « néon sur fond sombre » (arbre-circuit + texte « Arboretum »).
|
|
||||||
On extrait l'alpha par luminance (méthode propre pour ce type d'artwork glow-on-black) :
|
|
||||||
chaque pixel reçoit une transparence proportionnelle à sa luminosité, ce qui rend le
|
|
||||||
fond sombre totalement transparent, garde le cœur des traits opaque et conserve le halo
|
|
||||||
en semi-transparent — donc lisible sur n'importe quel fond.
|
|
||||||
|
|
||||||
Sorties :
|
|
||||||
brand/arboretum-logo.png logo complet transparent (haute déf) — Gitea / README
|
|
||||||
brand/arboretum-mark.png marque carrée transparente (arbre seul) — avatar Gitea
|
|
||||||
brand/arboretum-logo-on-dark.png logo complet sur fond #09090b (fallback fond clair)
|
|
||||||
packages/web/public/logo.png logo complet transparent, optimisé pour l'UI
|
|
||||||
packages/web/public/icon-192.png icône PWA maskable (arbre, fond #09090b)
|
|
||||||
packages/web/public/icon-512.png icône PWA maskable (arbre, fond #09090b)
|
|
||||||
packages/web/public/apple-touch-icon.png icône iOS 180 (arbre, fond #09090b)
|
|
||||||
packages/web/public/favicon.ico favicon transparent (arbre, 16/32/48)
|
|
||||||
|
|
||||||
Usage : python3 brand/build-assets.py <source.png>
|
|
||||||
"""
|
|
||||||
import sys
|
|
||||||
import numpy as np
|
|
||||||
from PIL import Image
|
|
||||||
|
|
||||||
SRC = sys.argv[1] if len(sys.argv) > 1 else "brand/arboretum-logo-source.png"
|
|
||||||
BG = (9, 9, 11) # #09090b — couleur de fond du dashboard (manifest background_color/theme_color)
|
|
||||||
|
|
||||||
# Découpe verticale arbre / texte (mesurée sur la source)
|
|
||||||
TREE_Y = (130, 930) # arbre + curseur >_
|
|
||||||
FULL_Y = (130, 1060) # arbre + texte
|
|
||||||
|
|
||||||
|
|
||||||
def extract_rgba(path):
|
|
||||||
"""Charge la source et calcule l'alpha par luminance (floor + knee)."""
|
|
||||||
rgb = np.asarray(Image.open(path).convert("RGB"), dtype=np.float32)
|
|
||||||
maxc = rgb.max(axis=2)
|
|
||||||
# floor > canal max du fond (~14) pour annuler totalement le fond ; knee = seuil d'opacité.
|
|
||||||
floor, knee = 20.0, 185.0 # < floor : transparent ; >= knee : opaque
|
|
||||||
alpha = np.clip((maxc - floor) / (knee - floor), 0.0, 1.0) * 255.0
|
|
||||||
alpha[alpha < 8] = 0.0 # gate anti-bruit : un vrai fond transparent et une bbox serrée
|
|
||||||
out = np.dstack([rgb, alpha]).astype(np.uint8)
|
|
||||||
return Image.fromarray(out, "RGBA")
|
|
||||||
|
|
||||||
|
|
||||||
def crop_band(rgba, y0, y1):
|
|
||||||
"""Recadre une bande verticale puis serre sur le contenu non transparent."""
|
|
||||||
band = rgba.crop((0, y0, rgba.width, y1))
|
|
||||||
bbox = band.getbbox() # bbox sur l'alpha
|
|
||||||
return band.crop(bbox)
|
|
||||||
|
|
||||||
|
|
||||||
def square(content, pad_frac, bg=None):
|
|
||||||
"""Centre `content` dans un carré ; bg=None → transparent, sinon fond plein."""
|
|
||||||
side = round(max(content.size) / (1 - 2 * pad_frac))
|
|
||||||
fill = (0, 0, 0, 0) if bg is None else (*bg, 255)
|
|
||||||
canvas = Image.new("RGBA", (side, side), fill)
|
|
||||||
canvas.paste(content, ((side - content.width) // 2, (side - content.height) // 2), content)
|
|
||||||
return canvas
|
|
||||||
|
|
||||||
|
|
||||||
def save(img, path, size=None):
|
|
||||||
if size:
|
|
||||||
img = img.resize((size, size), Image.LANCZOS)
|
|
||||||
img.save(path)
|
|
||||||
print(f" {path} {img.size[0]}x{img.size[1]}")
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
rgba = extract_rgba(SRC)
|
|
||||||
full = crop_band(rgba, *FULL_Y) # logo complet transparent serré
|
|
||||||
tree = crop_band(rgba, *TREE_Y) # arbre seul transparent serré
|
|
||||||
|
|
||||||
print("brand/")
|
|
||||||
save(full, "brand/arboretum-logo.png")
|
|
||||||
save(square(tree, 0.08), "brand/arboretum-mark.png")
|
|
||||||
# logo complet sur fond sombre (pour surfaces claires où la transparence gêne)
|
|
||||||
on_dark = Image.new("RGBA", (full.width + 160, full.height + 160), (*BG, 255))
|
|
||||||
on_dark.paste(full, (80, 80), full)
|
|
||||||
save(on_dark, "brand/arboretum-logo-on-dark.png")
|
|
||||||
|
|
||||||
print("packages/web/public/")
|
|
||||||
# logo UI : largeur max 600 px, transparent
|
|
||||||
ui = full.copy()
|
|
||||||
ui.thumbnail((600, 600), Image.LANCZOS)
|
|
||||||
ui.save("packages/web/public/logo.png")
|
|
||||||
print(f" packages/web/public/logo.png {ui.size[0]}x{ui.size[1]}")
|
|
||||||
# icônes maskable : arbre dans la zone sûre (contenu ~80 %), fond #09090b
|
|
||||||
mask = square(tree, 0.12, bg=BG)
|
|
||||||
save(mask, "packages/web/public/icon-192.png", 192)
|
|
||||||
save(mask, "packages/web/public/icon-512.png", 512)
|
|
||||||
save(mask, "packages/web/public/apple-touch-icon.png", 180)
|
|
||||||
# favicon : arbre transparent, multi-tailles
|
|
||||||
fav = square(tree, 0.04)
|
|
||||||
fav.save("packages/web/public/favicon.ico", sizes=[(16, 16), (32, 32), (48, 48)])
|
|
||||||
print(" packages/web/public/favicon.ico 16/32/48")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -720,9 +720,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@fastify/static": {
|
"node_modules/@fastify/static": {
|
||||||
"version": "9.1.3",
|
"version": "8.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@fastify/static/-/static-9.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@fastify/static/-/static-8.3.0.tgz",
|
||||||
"integrity": "sha512-aXrYtsiryLhRxRNaxNqsn7FUISeb7rB9q4eHUPIot5aeQBLNahnz1m6thzm7JWC1poSGXS9XrX8DvuMivp2hkQ==",
|
"integrity": "sha512-yKxviR5PH1OKNnisIzZKmgZSus0r2OZb8qCSbqmw34aolT4g3UlzYfeBRym+HJ1J471CR8e2ldNub4PubD1coA==",
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"type": "github",
|
"type": "github",
|
||||||
@@ -737,10 +737,10 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fastify/accept-negotiator": "^2.0.0",
|
"@fastify/accept-negotiator": "^2.0.0",
|
||||||
"@fastify/send": "^4.0.0",
|
"@fastify/send": "^4.0.0",
|
||||||
"content-disposition": "^1.0.1",
|
"content-disposition": "^0.5.4",
|
||||||
"fastify-plugin": "^5.0.0",
|
"fastify-plugin": "^5.0.0",
|
||||||
"fastq": "^1.17.1",
|
"fastq": "^1.17.1",
|
||||||
"glob": "^13.0.0"
|
"glob": "^11.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@fastify/websocket": {
|
"node_modules/@fastify/websocket": {
|
||||||
@@ -839,9 +839,14 @@
|
|||||||
"url": "https://github.com/sponsors/kazupon"
|
"url": "https://github.com/sponsors/kazupon"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@johanleroy/git-arboretum": {
|
"node_modules/@isaacs/cliui": {
|
||||||
"resolved": "packages/server",
|
"version": "9.0.0",
|
||||||
"link": true
|
"resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-9.0.0.tgz",
|
||||||
|
"integrity": "sha512-AokJm4tuBHillT+FpMtxQ60n8ObyXBatq7jD2/JA9dxbDDokKQm8KMht5ibGzLVU9IJDIKK4TPKgMHEYMn3lMg==",
|
||||||
|
"license": "BlueOak-1.0.0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@jridgewell/gen-mapping": {
|
"node_modules/@jridgewell/gen-mapping": {
|
||||||
"version": "0.3.13",
|
"version": "0.3.13",
|
||||||
@@ -905,15 +910,6 @@
|
|||||||
"@jridgewell/sourcemap-codec": "^1.4.14"
|
"@jridgewell/sourcemap-codec": "^1.4.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@lucide/vue": {
|
|
||||||
"version": "1.21.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/@lucide/vue/-/vue-1.21.0.tgz",
|
|
||||||
"integrity": "sha512-eoFn3tppjKAc12ZqdnRSMFdtwQ1ZMRQFb6SV1Eub6Y8kU28ccnqKeSFdnur9hMg8gIbosU2Y3WFJr/J/xS/IlQ==",
|
|
||||||
"license": "ISC",
|
|
||||||
"peerDependencies": {
|
|
||||||
"vue": ">=3.0.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@lukeed/ms": {
|
"node_modules/@lukeed/ms": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@lukeed/ms/-/ms-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/@lukeed/ms/-/ms-2.0.2.tgz",
|
||||||
@@ -2542,16 +2538,15 @@
|
|||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
"node_modules/content-disposition": {
|
"node_modules/content-disposition": {
|
||||||
"version": "1.1.0",
|
"version": "0.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||||
"integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==",
|
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"dependencies": {
|
||||||
"node": ">=18"
|
"safe-buffer": "5.2.1"
|
||||||
},
|
},
|
||||||
"funding": {
|
"engines": {
|
||||||
"type": "opencollective",
|
"node": ">= 0.6"
|
||||||
"url": "https://opencollective.com/express"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/cookie": {
|
"node_modules/cookie": {
|
||||||
@@ -2582,6 +2577,20 @@
|
|||||||
"url": "https://github.com/sponsors/mesqueeb"
|
"url": "https://github.com/sponsors/mesqueeb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/cross-spawn": {
|
||||||
|
"version": "7.0.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
|
||||||
|
"integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"path-key": "^3.1.0",
|
||||||
|
"shebang-command": "^2.0.0",
|
||||||
|
"which": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/csstype": {
|
"node_modules/csstype": {
|
||||||
"version": "3.2.3",
|
"version": "3.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||||
@@ -2957,6 +2966,22 @@
|
|||||||
"node": ">=20"
|
"node": ">=20"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/foreground-child": {
|
||||||
|
"version": "3.3.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
|
||||||
|
"integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"cross-spawn": "^7.0.6",
|
||||||
|
"signal-exit": "^4.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/fs-constants": {
|
"node_modules/fs-constants": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||||
@@ -2978,6 +3003,10 @@
|
|||||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/git-arboretum": {
|
||||||
|
"resolved": "packages/server",
|
||||||
|
"link": true
|
||||||
|
},
|
||||||
"node_modules/github-from-package": {
|
"node_modules/github-from-package": {
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
||||||
@@ -2985,17 +3014,24 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/glob": {
|
"node_modules/glob": {
|
||||||
"version": "13.0.6",
|
"version": "11.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz",
|
||||||
"integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==",
|
"integrity": "sha512-vuNwKSaKiqm7g0THUBu2x7ckSs3XJLXE+2ssL7/MfTGPLLcrJQ/4Uq1CjPTtO5cCIiRxqvN6Twy1qOwhL0Xjcw==",
|
||||||
|
"deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
|
||||||
"license": "BlueOak-1.0.0",
|
"license": "BlueOak-1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"minimatch": "^10.2.2",
|
"foreground-child": "^3.3.1",
|
||||||
"minipass": "^7.1.3",
|
"jackspeak": "^4.1.1",
|
||||||
"path-scurry": "^2.0.2"
|
"minimatch": "^10.1.1",
|
||||||
|
"minipass": "^7.1.2",
|
||||||
|
"package-json-from-dist": "^1.0.0",
|
||||||
|
"path-scurry": "^2.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"glob": "dist/esm/bin.mjs"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "18 || 20 || >=22"
|
"node": "20 || >=22"
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/isaacs"
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
@@ -3109,6 +3145,27 @@
|
|||||||
"url": "https://github.com/sponsors/mesqueeb"
|
"url": "https://github.com/sponsors/mesqueeb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/isexe": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/jackspeak": {
|
||||||
|
"version": "4.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.2.3.tgz",
|
||||||
|
"integrity": "sha512-ykkVRwrYvFm1nb2AJfKKYPr0emF6IiXDYUaFx4Zn9ZuIH7MrzEZ3sD5RlqGXNRpHtvUHJyOnCEFxOlNDtGo7wg==",
|
||||||
|
"license": "BlueOak-1.0.0",
|
||||||
|
"dependencies": {
|
||||||
|
"@isaacs/cliui": "^9.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": "20 || >=22"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/jiti": {
|
"node_modules/jiti": {
|
||||||
"version": "2.7.0",
|
"version": "2.7.0",
|
||||||
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
|
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
|
||||||
@@ -3654,6 +3711,12 @@
|
|||||||
"wrappy": "1"
|
"wrappy": "1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/package-json-from-dist": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
|
||||||
|
"license": "BlueOak-1.0.0"
|
||||||
|
},
|
||||||
"node_modules/path-browserify": {
|
"node_modules/path-browserify": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz",
|
||||||
@@ -3661,6 +3724,15 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/path-key": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/path-scurry": {
|
"node_modules/path-scurry": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz",
|
||||||
@@ -4112,6 +4184,27 @@
|
|||||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/shebang-command": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"shebang-regex": "^3.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/shebang-regex": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
|
||||||
|
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/siginfo": {
|
"node_modules/siginfo": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
|
||||||
@@ -4119,6 +4212,18 @@
|
|||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "ISC"
|
"license": "ISC"
|
||||||
},
|
},
|
||||||
|
"node_modules/signal-exit": {
|
||||||
|
"version": "4.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
|
||||||
|
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
|
||||||
|
"license": "ISC",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/isaacs"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/simple-concat": {
|
"node_modules/simple-concat": {
|
||||||
"version": "1.0.1",
|
"version": "1.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
|
||||||
@@ -4794,6 +4899,21 @@
|
|||||||
"node": ">= 16"
|
"node": ">= 16"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/which": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"isexe": "^2.0.0"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"node-which": "bin/node-which"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/why-is-node-running": {
|
"node_modules/why-is-node-running": {
|
||||||
"version": "2.3.0",
|
"version": "2.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
|
||||||
@@ -4839,16 +4959,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages/server": {
|
"packages/server": {
|
||||||
"name": "@johanleroy/git-arboretum",
|
"name": "git-arboretum",
|
||||||
"version": "1.3.0",
|
"version": "0.1.0",
|
||||||
"bundleDependencies": [
|
|
||||||
"@arboretum/shared"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@arboretum/shared": "0.1.0",
|
"@arboretum/shared": "0.1.0",
|
||||||
"@fastify/cookie": "^11.0.0",
|
"@fastify/cookie": "^11.0.0",
|
||||||
"@fastify/static": "^9.0.0",
|
"@fastify/static": "^8.0.0",
|
||||||
"@fastify/websocket": "^11.0.0",
|
"@fastify/websocket": "^11.0.0",
|
||||||
"@homebridge/node-pty-prebuilt-multiarch": "^0.13.0",
|
"@homebridge/node-pty-prebuilt-multiarch": "^0.13.0",
|
||||||
"@xterm/headless": "^6.0.0",
|
"@xterm/headless": "^6.0.0",
|
||||||
@@ -4875,7 +4992,6 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@arboretum/shared": "*",
|
"@arboretum/shared": "*",
|
||||||
"@lucide/vue": "^1.21.0",
|
|
||||||
"@xterm/addon-fit": "^0.11.0",
|
"@xterm/addon-fit": "^0.11.0",
|
||||||
"@xterm/addon-webgl": "^0.19.0",
|
"@xterm/addon-webgl": "^0.19.0",
|
||||||
"@xterm/xterm": "^6.0.0",
|
"@xterm/xterm": "^6.0.0",
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
"node": ">=22.16"
|
"node": ">=22.16"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "npm run build -w @arboretum/shared -w @johanleroy/git-arboretum -w @arboretum/web",
|
"build": "npm run build -w @arboretum/shared -w git-arboretum -w @arboretum/web",
|
||||||
"typecheck": "tsc -b packages/shared packages/server",
|
"typecheck": "tsc -b packages/shared packages/server",
|
||||||
"pack": "npm run build && npm pack -w @johanleroy/git-arboretum",
|
"pack": "npm run build && npm pack -w git-arboretum",
|
||||||
"test": "vitest run",
|
"test": "vitest run",
|
||||||
"dev:server": "npm run dev -w @johanleroy/git-arboretum",
|
"dev:server": "npm run dev -w git-arboretum",
|
||||||
"dev:web": "npm run dev -w @arboretum/web"
|
"dev:web": "npm run dev -w @arboretum/web"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,59 +1,30 @@
|
|||||||
{
|
{
|
||||||
"name": "@johanleroy/git-arboretum",
|
"name": "git-arboretum",
|
||||||
"version": "1.3.0",
|
"version": "0.1.0",
|
||||||
"description": "Self-hosted web dashboard for git worktrees and the Claude Code sessions running on them",
|
"description": "Self-hosted web dashboard for git worktrees and the Claude Code sessions running on them",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": "Johan LEROY <contact@johanleroy.fr>",
|
|
||||||
"homepage": "https://git.lidge.fr/johanleroy/arboretum#readme",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "git+https://git.lidge.fr/johanleroy/arboretum.git",
|
|
||||||
"directory": "packages/server"
|
|
||||||
},
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://git.lidge.fr/johanleroy/arboretum/issues"
|
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"git",
|
|
||||||
"worktree",
|
|
||||||
"claude",
|
|
||||||
"claude-code",
|
|
||||||
"dashboard",
|
|
||||||
"self-hosted",
|
|
||||||
"pty",
|
|
||||||
"terminal",
|
|
||||||
"cli",
|
|
||||||
"daemon",
|
|
||||||
"pwa"
|
|
||||||
],
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"arboretum": "./dist/index.js"
|
"arboretum": "./dist/index.js"
|
||||||
},
|
},
|
||||||
"main": "./dist/app.js",
|
"main": "./dist/app.js",
|
||||||
"files": [
|
"files": [
|
||||||
"dist/**/*.js",
|
"dist",
|
||||||
"public"
|
"public"
|
||||||
],
|
],
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=22.16"
|
"node": ">=22.16"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
|
||||||
"registry": "https://git.lidge.fr/api/packages/johanleroy/npm/"
|
|
||||||
},
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc -b",
|
"build": "tsc -b",
|
||||||
"dev": "tsc -b --watch & node --watch dist/index.js",
|
"dev": "tsc -b --watch & node --watch dist/index.js",
|
||||||
"prepack": "node scripts/copy-web.mjs && node scripts/vendor-shared.mjs && node scripts/copy-meta.mjs",
|
"prepack": "node scripts/copy-web.mjs",
|
||||||
"test": "vitest run"
|
"test": "vitest run"
|
||||||
},
|
},
|
||||||
"bundleDependencies": [
|
|
||||||
"@arboretum/shared"
|
|
||||||
],
|
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@arboretum/shared": "0.1.0",
|
"@arboretum/shared": "0.1.0",
|
||||||
"@fastify/cookie": "^11.0.0",
|
"@fastify/cookie": "^11.0.0",
|
||||||
"@fastify/static": "^9.0.0",
|
"@fastify/static": "^8.0.0",
|
||||||
"@fastify/websocket": "^11.0.0",
|
"@fastify/websocket": "^11.0.0",
|
||||||
"@homebridge/node-pty-prebuilt-multiarch": "^0.13.0",
|
"@homebridge/node-pty-prebuilt-multiarch": "^0.13.0",
|
||||||
"@xterm/headless": "^6.0.0",
|
"@xterm/headless": "^6.0.0",
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const check = (name, ok, detail = '') => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const tmp = mkdtempSync(join(tmpdir(), 'arb-accept-'));
|
const tmp = mkdtempSync(join(tmpdir(), 'arb-accept-'));
|
||||||
const srv = spawn('node', [join(serverDir, 'dist', 'index.js'), '--port', String(PORT), '--db', join(tmp, 'a.db'), '--no-discover'], {
|
const srv = spawn('node', [join(serverDir, 'dist', 'index.js'), '--port', String(PORT), '--db', join(tmp, 'a.db')], {
|
||||||
env: { ...process.env, ARBORETUM_LOG: 'warn' },
|
env: { ...process.env, ARBORETUM_LOG: 'warn' },
|
||||||
stdio: ['ignore', 'pipe', 'pipe'],
|
stdio: ['ignore', 'pipe', 'pipe'],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ writeFileSync(
|
|||||||
|
|
||||||
const srv = spawn(
|
const srv = spawn(
|
||||||
'node',
|
'node',
|
||||||
[join(serverDir, 'dist', 'index.js'), '--port', String(PORT), '--db', join(tmp, 'a.db'), '--claude-home', claudeHome, '--no-discover'],
|
[join(serverDir, 'dist', 'index.js'), '--port', String(PORT), '--db', join(tmp, 'a.db'), '--claude-home', claudeHome],
|
||||||
{ env: { ...process.env, ARBORETUM_LOG: 'warn', PATH: `${fakeBin}:${process.env.PATH}` }, stdio: ['ignore', 'pipe', 'pipe'] },
|
{ env: { ...process.env, ARBORETUM_LOG: 'warn', PATH: `${fakeBin}:${process.env.PATH}` }, stdio: ['ignore', 'pipe', 'pipe'] },
|
||||||
);
|
);
|
||||||
let srvOut = '';
|
let srvOut = '';
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ git('commit', '-m', 'init');
|
|||||||
|
|
||||||
const srv = spawn(
|
const srv = spawn(
|
||||||
'node',
|
'node',
|
||||||
[join(serverDir, 'dist', 'index.js'), '--port', String(PORT), '--db', join(tmp, 'a.db'), '--claude-home', join(tmp, 'claude'), '--no-discover'],
|
[join(serverDir, 'dist', 'index.js'), '--port', String(PORT), '--db', join(tmp, 'a.db'), '--claude-home', join(tmp, 'claude')],
|
||||||
{ env: { ...process.env, ARBORETUM_LOG: 'warn' }, stdio: ['ignore', 'pipe', 'pipe'] },
|
{ env: { ...process.env, ARBORETUM_LOG: 'warn' }, stdio: ['ignore', 'pipe', 'pipe'] },
|
||||||
);
|
);
|
||||||
let srvOut = '';
|
let srvOut = '';
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const tmp = mkdtempSync(join(tmpdir(), 'arb-accept-p4-'));
|
|||||||
|
|
||||||
const srv = spawn(
|
const srv = spawn(
|
||||||
'node',
|
'node',
|
||||||
[join(serverDir, 'dist', 'index.js'), '--port', String(PORT), '--db', join(tmp, 'a.db'), '--claude-home', join(tmp, 'claude'), '--no-discover'],
|
[join(serverDir, 'dist', 'index.js'), '--port', String(PORT), '--db', join(tmp, 'a.db'), '--claude-home', join(tmp, 'claude')],
|
||||||
{ env: { ...process.env, ARBORETUM_LOG: 'warn' }, stdio: ['ignore', 'pipe', 'pipe'] },
|
{ env: { ...process.env, ARBORETUM_LOG: 'warn' }, stdio: ['ignore', 'pipe', 'pipe'] },
|
||||||
);
|
);
|
||||||
let srvOut = '';
|
let srvOut = '';
|
||||||
|
|||||||
@@ -1,146 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
// Acceptation P5 (sans navigateur, sans quota Claude) : groupes de travail.
|
|
||||||
// Vrai daemon + vrai repo git tmp. Couvre : CRUD groupe via REST, broadcast WS group_update/
|
|
||||||
// group_removed sur le topic 'groups', ajout/retrait de repo, et purge CASCADE de la membership
|
|
||||||
// quand le repo est supprimé (PRAGMA foreign_keys = ON).
|
|
||||||
import { spawn, execFileSync } from 'node:child_process';
|
|
||||||
import { mkdtempSync, rmSync } from 'node:fs';
|
|
||||||
import { tmpdir } from 'node:os';
|
|
||||||
import { join, dirname } from 'node:path';
|
|
||||||
import { fileURLToPath } from 'node:url';
|
|
||||||
import { createRequire } from 'node:module';
|
|
||||||
|
|
||||||
const require = createRequire(import.meta.url);
|
|
||||||
const WebSocket = require('ws');
|
|
||||||
|
|
||||||
const PORT = 7545;
|
|
||||||
const ORIGIN = `http://127.0.0.1:${PORT}`;
|
|
||||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
||||||
const serverDir = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
||||||
const results = [];
|
|
||||||
const check = (name, ok, detail = '') => {
|
|
||||||
results.push({ name, ok, detail });
|
|
||||||
console.log(`${ok ? '✅' : '❌'} ${name}${detail ? ` — ${detail}` : ''}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const tmp = mkdtempSync(join(tmpdir(), 'arb-accept-p5-'));
|
|
||||||
const repo = join(tmp, 'demo-repo');
|
|
||||||
execFileSync('mkdir', ['-p', repo]);
|
|
||||||
const git = (...args) => execFileSync('git', args, { cwd: repo, stdio: 'pipe' });
|
|
||||||
git('init', '-b', 'main');
|
|
||||||
git('config', 'user.email', 'test@arboretum.dev');
|
|
||||||
git('config', 'user.name', 'Test');
|
|
||||||
execFileSync('bash', ['-lc', 'echo "# demo" > README.md'], { cwd: repo });
|
|
||||||
git('add', '-A');
|
|
||||||
git('commit', '-m', 'init');
|
|
||||||
|
|
||||||
const srv = spawn(
|
|
||||||
'node',
|
|
||||||
[join(serverDir, 'dist', 'index.js'), '--port', String(PORT), '--db', join(tmp, 'a.db'), '--claude-home', join(tmp, 'claude'), '--no-discover'],
|
|
||||||
{ env: { ...process.env, ARBORETUM_LOG: 'warn' }, stdio: ['ignore', 'pipe', 'pipe'] },
|
|
||||||
);
|
|
||||||
let srvOut = '';
|
|
||||||
srv.stdout.on('data', (d) => (srvOut += d));
|
|
||||||
srv.stderr.on('data', (d) => (srvOut += d));
|
|
||||||
|
|
||||||
function wsClient(cookie) {
|
|
||||||
const ws = new WebSocket(`ws://127.0.0.1:${PORT}/ws`, { headers: { Origin: ORIGIN, Cookie: cookie } });
|
|
||||||
const state = { msgs: [] };
|
|
||||||
ws.on('message', (data, isBinary) => {
|
|
||||||
if (!isBinary) state.msgs.push(JSON.parse(String(data)));
|
|
||||||
});
|
|
||||||
const waitMsg = async (pred, timeout = 8000) => {
|
|
||||||
const t0 = Date.now();
|
|
||||||
while (Date.now() - t0 < timeout) {
|
|
||||||
const m = state.msgs.find(pred);
|
|
||||||
if (m) return m;
|
|
||||||
await sleep(50);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
return { ws, state, waitMsg, send: (m) => ws.send(JSON.stringify(m)) };
|
|
||||||
}
|
|
||||||
|
|
||||||
const j = (path, method, cookie, body) =>
|
|
||||||
fetch(`${ORIGIN}${path}`, {
|
|
||||||
method,
|
|
||||||
headers: { Origin: ORIGIN, Cookie: cookie, ...(body ? { 'Content-Type': 'application/json' } : {}) },
|
|
||||||
...(body ? { body: JSON.stringify(body) } : {}),
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
await sleep(1500);
|
|
||||||
const token = /arb_[0-9a-f]+/.exec(srvOut)?.[0];
|
|
||||||
check('boot + token bootstrap', !!token);
|
|
||||||
|
|
||||||
const login = await fetch(`${ORIGIN}/api/v1/auth/login`, {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json', Origin: ORIGIN },
|
|
||||||
body: JSON.stringify({ token }),
|
|
||||||
});
|
|
||||||
const cookie = login.headers.get('set-cookie')?.split(';')[0] ?? '';
|
|
||||||
check('login → cookie', login.status === 200);
|
|
||||||
|
|
||||||
const c = wsClient(cookie);
|
|
||||||
await new Promise((res, rej) => (c.ws.on('open', res), c.ws.on('error', rej)));
|
|
||||||
c.send({ type: 'hello', protocol: 1 });
|
|
||||||
await c.waitMsg((m) => m.type === 'hello_ok');
|
|
||||||
c.send({ type: 'sub', topics: ['sessions', 'worktrees', 'groups'] });
|
|
||||||
|
|
||||||
// Enregistrement d'un repo (cible de la membership).
|
|
||||||
const addRepo = await j('/api/v1/repos', 'POST', cookie, { path: repo });
|
|
||||||
const repoSummary = (await addRepo.json()).repo;
|
|
||||||
check('POST /repos → 201', addRepo.status === 201 && repoSummary?.valid === true);
|
|
||||||
|
|
||||||
// Création d'un groupe vide via REST → broadcast WS group_update.
|
|
||||||
const created = await j('/api/v1/groups', 'POST', cookie, { label: 'Sprint 42', color: '#4f46e5' });
|
|
||||||
const group = (await created.json()).group;
|
|
||||||
check('POST /groups → 201', created.status === 201 && group?.label === 'Sprint 42' && group?.repoIds.length === 0);
|
|
||||||
const pushedCreate = await c.waitMsg((m) => m.type === 'group_update' && m.group?.id === group.id);
|
|
||||||
check('broadcast WS group_update (création)', !!pushedCreate);
|
|
||||||
|
|
||||||
const list = await (await j('/api/v1/groups', 'GET', cookie)).json();
|
|
||||||
check('GET /groups → groupe présent', list.groups?.some((g) => g.id === group.id));
|
|
||||||
|
|
||||||
// Ajout du repo au groupe → group_update avec repoIds peuplé.
|
|
||||||
const added = await j(`/api/v1/groups/${group.id}/repos`, 'POST', cookie, { repoId: repoSummary.id });
|
|
||||||
const addedBody = await added.json();
|
|
||||||
check('POST /groups/:id/repos → repoIds', added.status === 200 && addedBody.group?.repoIds.includes(repoSummary.id));
|
|
||||||
const pushedAdd = await c.waitMsg((m) => m.type === 'group_update' && m.group?.repoIds?.includes(repoSummary.id));
|
|
||||||
check('broadcast WS group_update (ajout repo)', !!pushedAdd);
|
|
||||||
|
|
||||||
// Renommage via PATCH.
|
|
||||||
const patched = await j(`/api/v1/groups/${group.id}`, 'PATCH', cookie, { label: 'Renamed' });
|
|
||||||
check('PATCH /groups/:id → 200 (renommé)', patched.status === 200 && (await patched.json()).group?.label === 'Renamed');
|
|
||||||
|
|
||||||
// repoId inexistant → 404.
|
|
||||||
const bad = await j(`/api/v1/groups/${group.id}/repos`, 'POST', cookie, { repoId: 'does-not-exist' });
|
|
||||||
check('POST repo inexistant → 404', bad.status === 404);
|
|
||||||
|
|
||||||
// Suppression du repo → CASCADE purge la membership.
|
|
||||||
const delRepo = await j(`/api/v1/repos/${repoSummary.id}`, 'DELETE', cookie);
|
|
||||||
check('DELETE /repos/:id → 200', delRepo.status === 200);
|
|
||||||
await sleep(200);
|
|
||||||
const afterCascade = await (await j(`/api/v1/groups/${group.id}`, 'GET', cookie)).json();
|
|
||||||
check('CASCADE : membership purgée à la suppression du repo', afterCascade.group?.repoIds.length === 0);
|
|
||||||
|
|
||||||
// Suppression du groupe → broadcast WS group_removed.
|
|
||||||
const delGroup = await j(`/api/v1/groups/${group.id}`, 'DELETE', cookie);
|
|
||||||
check('DELETE /groups/:id → 200', delGroup.status === 200);
|
|
||||||
const removed = await c.waitMsg((m) => m.type === 'group_removed' && m.groupId === group.id);
|
|
||||||
check('broadcast WS group_removed', !!removed);
|
|
||||||
const delAgain = await j(`/api/v1/groups/${group.id}`, 'DELETE', cookie);
|
|
||||||
check('DELETE groupe inconnu → 404', delAgain.status === 404);
|
|
||||||
|
|
||||||
c.ws.close();
|
|
||||||
} catch (err) {
|
|
||||||
check('exception', false, String(err));
|
|
||||||
} finally {
|
|
||||||
srv.kill('SIGTERM');
|
|
||||||
await sleep(1500);
|
|
||||||
check('arrêt propre du daemon (SIGTERM)', srv.exitCode === 0 || srv.signalCode === null || srv.exitCode === null);
|
|
||||||
rmSync(tmp, { recursive: true, force: true });
|
|
||||||
const failed = results.filter((r) => !r.ok);
|
|
||||||
console.log(failed.length === 0 ? '\nACCEPTANCE P5: ALL GREEN' : `\nACCEPTANCE P5: ${failed.length} FAILURE(S)`);
|
|
||||||
process.exit(failed.length === 0 ? 0 : 1);
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
// Copie le README et la LICENSE racine dans packages/server/ avant le pack, pour que
|
|
||||||
// la page du paquet (registre Gitea) ne soit pas nue et que la licence soit jointe.
|
|
||||||
// npm inclut automatiquement README* et LICENSE* dans le tarball s'ils sont présents.
|
|
||||||
// Branché sur le hook "prepack". Ces copies sont gitignorées (générées, non versionnées).
|
|
||||||
import { copyFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
|
|
||||||
import { join, dirname } from 'node:path';
|
|
||||||
import { fileURLToPath } from 'node:url';
|
|
||||||
|
|
||||||
const serverDir = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
||||||
const rootDir = join(serverDir, '..', '..');
|
|
||||||
|
|
||||||
// README : réécrit les chemins d'images relatifs (brand/…) en URL absolue Gitea raw,
|
|
||||||
// sinon le logo est cassé hors du repo (sur la page du paquet).
|
|
||||||
const readmeSrc = join(rootDir, 'README.md');
|
|
||||||
if (existsSync(readmeSrc)) {
|
|
||||||
const rawBase = 'https://git.lidge.fr/johanleroy/arboretum/raw/branch/main/';
|
|
||||||
const srcBase = 'https://git.lidge.fr/johanleroy/arboretum/src/branch/main/';
|
|
||||||
const readme = readFileSync(readmeSrc, 'utf8')
|
|
||||||
.replaceAll('src="brand/', `src="${rawBase}brand/`)
|
|
||||||
.replaceAll('href="README.fr.md"', `href="${srcBase}README.fr.md"`);
|
|
||||||
writeFileSync(join(serverDir, 'README.md'), readme);
|
|
||||||
console.log('copy-meta: README.md copié (chemins images + lien FR réécrits en absolu)');
|
|
||||||
} else {
|
|
||||||
console.error(`copy-meta: ${readmeSrc} introuvable`);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const licenseSrc = join(rootDir, 'LICENSE');
|
|
||||||
if (existsSync(licenseSrc)) {
|
|
||||||
copyFileSync(licenseSrc, join(serverDir, 'LICENSE'));
|
|
||||||
console.log('copy-meta: LICENSE copié');
|
|
||||||
} else {
|
|
||||||
console.error(`copy-meta: ${licenseSrc} introuvable`);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
// Embarque @arboretum/shared (dépendance runtime non publiée) DANS le tarball npm.
|
|
||||||
// Branché sur le hook "prepack", aux côtés de bundleDependencies dans package.json.
|
|
||||||
//
|
|
||||||
// Pourquoi un vrai dossier et pas le symlink workspace : sous npm workspaces, shared
|
|
||||||
// est seulement symlinké dans le node_modules racine ; `npm pack` n'embarque une
|
|
||||||
// bundleDependency que si elle existe comme VRAI dossier dans le node_modules du
|
|
||||||
// paquet packé (packages/server/node_modules/@arboretum/shared). On le matérialise ici.
|
|
||||||
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
||||||
import { join, dirname } from 'node:path';
|
|
||||||
import { fileURLToPath } from 'node:url';
|
|
||||||
|
|
||||||
const serverDir = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
||||||
const sharedDir = join(serverDir, '..', 'shared');
|
|
||||||
const sharedDist = join(sharedDir, 'dist');
|
|
||||||
const target = join(serverDir, 'node_modules', '@arboretum', 'shared');
|
|
||||||
|
|
||||||
if (!existsSync(sharedDist)) {
|
|
||||||
console.error(
|
|
||||||
`vendor-shared: ${sharedDist} introuvable — lance "npm run build" (shared doit être compilé) avant le pack.`,
|
|
||||||
);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// package.json minimal et déterministe : on reprend les champs de résolution réels de
|
|
||||||
// shared (version incluse, pour rester synchro), sans scripts ni files inutiles au runtime.
|
|
||||||
const shared = JSON.parse(readFileSync(join(sharedDir, 'package.json'), 'utf8'));
|
|
||||||
const minimal = {
|
|
||||||
name: shared.name,
|
|
||||||
version: shared.version,
|
|
||||||
type: shared.type,
|
|
||||||
main: shared.main,
|
|
||||||
types: shared.types,
|
|
||||||
exports: shared.exports,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Idempotent : on repart d'un dossier propre à chaque pack.
|
|
||||||
rmSync(target, { recursive: true, force: true });
|
|
||||||
mkdirSync(target, { recursive: true });
|
|
||||||
writeFileSync(join(target, 'package.json'), JSON.stringify(minimal, null, 2) + '\n');
|
|
||||||
cpSync(sharedDist, join(target, 'dist'), { recursive: true });
|
|
||||||
|
|
||||||
console.log(`vendor-shared: embarqué ${shared.name}@${shared.version} -> ${target}`);
|
|
||||||
@@ -11,17 +11,12 @@ import { AuthService, LoginRateLimiter, type AuthContext } from './auth/service.
|
|||||||
import { PtyManager } from './core/pty-manager.js';
|
import { PtyManager } from './core/pty-manager.js';
|
||||||
import { DiscoveryService } from './core/discovery-service.js';
|
import { DiscoveryService } from './core/discovery-service.js';
|
||||||
import { WorktreeManager } from './core/worktree-manager.js';
|
import { WorktreeManager } from './core/worktree-manager.js';
|
||||||
import { RepoDiscoveryService } from './core/repo-discovery.js';
|
|
||||||
import { GroupManager } from './core/group-manager.js';
|
|
||||||
import { PushService } from './core/push-service.js';
|
import { PushService } from './core/push-service.js';
|
||||||
import { registerAuthRoutes } from './routes/auth.js';
|
import { registerAuthRoutes } from './routes/auth.js';
|
||||||
import { registerSessionRoutes } from './routes/sessions.js';
|
import { registerSessionRoutes } from './routes/sessions.js';
|
||||||
import { registerRepoRoutes } from './routes/repos.js';
|
import { registerRepoRoutes } from './routes/repos.js';
|
||||||
import { registerGroupRoutes } from './routes/groups.js';
|
|
||||||
import { registerWorktreeRoutes } from './routes/worktrees.js';
|
import { registerWorktreeRoutes } from './routes/worktrees.js';
|
||||||
import { registerPushRoutes } from './routes/push.js';
|
import { registerPushRoutes } from './routes/push.js';
|
||||||
import { registerSettingsRoutes } from './routes/settings.js';
|
|
||||||
import { registerFsRoutes } from './routes/fs.js';
|
|
||||||
import { registerWsGateway } from './ws/gateway.js';
|
import { registerWsGateway } from './ws/gateway.js';
|
||||||
|
|
||||||
declare module 'fastify' {
|
declare module 'fastify' {
|
||||||
@@ -38,9 +33,7 @@ export interface AppBundle {
|
|||||||
auth: AuthService;
|
auth: AuthService;
|
||||||
manager: PtyManager;
|
manager: PtyManager;
|
||||||
discovery: DiscoveryService;
|
discovery: DiscoveryService;
|
||||||
repoDiscovery: RepoDiscoveryService;
|
|
||||||
worktrees: WorktreeManager;
|
worktrees: WorktreeManager;
|
||||||
groups: GroupManager;
|
|
||||||
push: PushService;
|
push: PushService;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,9 +49,6 @@ export function buildApp(config: Config, db: Db, serverVersion: string): AppBund
|
|||||||
sessionsDir: config.claudeSessionsDir,
|
sessionsDir: config.claudeSessionsDir,
|
||||||
});
|
});
|
||||||
const worktrees = new WorktreeManager(db, manager, discovery);
|
const worktrees = new WorktreeManager(db, manager, discovery);
|
||||||
// Démarré dans runDaemon() (jamais ici) → le scan ne tourne pas pendant les tests qui appellent buildApp.
|
|
||||||
const repoDiscovery = new RepoDiscoveryService(db, worktrees);
|
|
||||||
const groups = new GroupManager(db);
|
|
||||||
|
|
||||||
void app.register(fastifyCookie);
|
void app.register(fastifyCookie);
|
||||||
void app.register(fastifyWebsocket, {
|
void app.register(fastifyWebsocket, {
|
||||||
@@ -99,16 +89,13 @@ export function buildApp(config: Config, db: Db, serverVersion: string): AppBund
|
|||||||
|
|
||||||
registerAuthRoutes(app, auth, limiter, serverVersion);
|
registerAuthRoutes(app, auth, limiter, serverVersion);
|
||||||
registerSessionRoutes(app, manager, discovery);
|
registerSessionRoutes(app, manager, discovery);
|
||||||
registerRepoRoutes(app, worktrees, db);
|
registerRepoRoutes(app, worktrees);
|
||||||
registerGroupRoutes(app, groups);
|
|
||||||
registerWorktreeRoutes(app, worktrees);
|
registerWorktreeRoutes(app, worktrees);
|
||||||
registerPushRoutes(app, push);
|
registerPushRoutes(app, push);
|
||||||
registerSettingsRoutes(app, db, config, serverVersion, push);
|
|
||||||
registerFsRoutes(app);
|
|
||||||
// La route websocket doit être déclarée APRÈS le chargement du plugin (contexte
|
// La route websocket doit être déclarée APRÈS le chargement du plugin (contexte
|
||||||
// encapsulé) — sinon le handler reçoit la signature REST (request, reply).
|
// encapsulé) — sinon le handler reçoit la signature REST (request, reply).
|
||||||
void app.register(async (scoped) => {
|
void app.register(async (scoped) => {
|
||||||
registerWsGateway(scoped, manager, discovery, worktrees, groups, serverVersion);
|
registerWsGateway(scoped, manager, discovery, worktrees, serverVersion);
|
||||||
});
|
});
|
||||||
|
|
||||||
// SPA buildée embarquée dans le paquet npm (public/) — absente en dev (vite dev sert le front)
|
// SPA buildée embarquée dans le paquet npm (public/) — absente en dev (vite dev sert le front)
|
||||||
@@ -123,5 +110,5 @@ export function buildApp(config: Config, db: Db, serverVersion: string): AppBund
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return { app, auth, manager, discovery, repoDiscovery, worktrees, groups, push };
|
return { app, auth, manager, discovery, worktrees, push };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,60 +35,11 @@ export class AuthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createToken(label: string): string {
|
createToken(label: string): string {
|
||||||
return this.createTokenRecord(label).token;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Comme createToken mais renvoie aussi l'id (pour l'API de gestion des tokens). */
|
|
||||||
createTokenRecord(label: string): { id: string; token: string } {
|
|
||||||
const id = randomUUID();
|
|
||||||
const raw = `arb_${randomBytes(24).toString('hex')}`;
|
const raw = `arb_${randomBytes(24).toString('hex')}`;
|
||||||
this.db
|
this.db
|
||||||
.prepare('INSERT INTO auth_tokens (id, label, token_hash, created_at) VALUES (?, ?, ?, ?)')
|
.prepare('INSERT INTO auth_tokens (id, label, token_hash, created_at) VALUES (?, ?, ?, ?)')
|
||||||
.run(id, label, sha256(raw), new Date().toISOString());
|
.run(randomUUID(), label, sha256(raw), new Date().toISOString());
|
||||||
return { id, token: raw };
|
return raw;
|
||||||
}
|
|
||||||
|
|
||||||
/** Tokens actifs (non révoqués), du plus ancien au plus récent. Ne renvoie JAMAIS le hash. */
|
|
||||||
listTokens(): Array<{ id: string; label: string; createdAt: string; lastUsedAt: string | null }> {
|
|
||||||
return this.db
|
|
||||||
.prepare(
|
|
||||||
'SELECT id, label, created_at AS createdAt, last_used_at AS lastUsedAt FROM auth_tokens WHERE revoked_at IS NULL ORDER BY created_at',
|
|
||||||
)
|
|
||||||
.all() as Array<{ id: string; label: string; createdAt: string; lastUsedAt: string | null }>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Nombre de tokens actifs (non révoqués). */
|
|
||||||
countActiveTokens(): number {
|
|
||||||
return (this.db.prepare('SELECT COUNT(*) AS n FROM auth_tokens WHERE revoked_at IS NULL').get() as { n: number }).n;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Révoque un token. Refuse de révoquer le DERNIER token actif (sinon lock-out total) → 'last'.
|
|
||||||
* 'ok' = révoqué ; 'not_found' = id inconnu ou déjà révoqué.
|
|
||||||
*/
|
|
||||||
revokeToken(id: string): 'ok' | 'last' | 'not_found' {
|
|
||||||
// Transaction : le check « dernier token » et l'UPDATE doivent être atomiques (garde
|
|
||||||
// anti lock-out robuste, même si un refactor futur introduisait de la concurrence).
|
|
||||||
this.db.exec('BEGIN IMMEDIATE');
|
|
||||||
try {
|
|
||||||
const row = this.db.prepare('SELECT id FROM auth_tokens WHERE id = ? AND revoked_at IS NULL').get(id) as
|
|
||||||
| { id: string }
|
|
||||||
| undefined;
|
|
||||||
let result: 'ok' | 'last' | 'not_found';
|
|
||||||
if (!row) {
|
|
||||||
result = 'not_found';
|
|
||||||
} else if (this.countActiveTokens() <= 1) {
|
|
||||||
result = 'last';
|
|
||||||
} else {
|
|
||||||
this.db.prepare('UPDATE auth_tokens SET revoked_at = ? WHERE id = ?').run(new Date().toISOString(), id);
|
|
||||||
result = 'ok';
|
|
||||||
}
|
|
||||||
this.db.exec('COMMIT');
|
|
||||||
return result;
|
|
||||||
} catch (err) {
|
|
||||||
this.db.exec('ROLLBACK');
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyRawToken(raw: string): AuthContext | null {
|
verifyRawToken(raw: string): AuthContext | null {
|
||||||
|
|||||||
@@ -1,363 +0,0 @@
|
|||||||
import { parseArgs } from 'node:util';
|
|
||||||
import { spawnSync } from 'node:child_process';
|
|
||||||
import { mkdirSync, writeFileSync, rmSync, existsSync } from 'node:fs';
|
|
||||||
import { homedir } from 'node:os';
|
|
||||||
import { join, dirname } from 'node:path';
|
|
||||||
import { fileURLToPath } from 'node:url';
|
|
||||||
import { loadConfig } from '../config.js';
|
|
||||||
import { openDb } from '../db/index.js';
|
|
||||||
import { AuthService } from '../auth/service.js';
|
|
||||||
|
|
||||||
// Nom de l'unit systemd (Linux) et label launchd par défaut (macOS, surchargeable via --label).
|
|
||||||
const SERVICE_NAME = 'arboretum';
|
|
||||||
const LAUNCHD_LABEL = 'fr.lidge.arboretum';
|
|
||||||
|
|
||||||
export type SupportedPlatform = 'linux' | 'darwin';
|
|
||||||
|
|
||||||
export interface InstallFlags {
|
|
||||||
port?: string | undefined;
|
|
||||||
bind?: string | undefined;
|
|
||||||
allowOrigin: string[];
|
|
||||||
db?: string | undefined;
|
|
||||||
vapidContact?: string | undefined;
|
|
||||||
claudeHome?: string | undefined;
|
|
||||||
binPath?: string | undefined;
|
|
||||||
label: string;
|
|
||||||
dryRun: boolean;
|
|
||||||
noEnable: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Fonctions pures (génération de contenu / chemins) ────────────────────────────────
|
|
||||||
|
|
||||||
/** macOS (launchd) et Linux (systemd) uniquement ; sinon throw avec un message pédagogique. */
|
|
||||||
export function detectPlatform(platform: NodeJS.Platform = process.platform): SupportedPlatform {
|
|
||||||
if (platform === 'linux' || platform === 'darwin') return platform;
|
|
||||||
throw new Error(
|
|
||||||
`Automatic service installation is supported on Linux (systemd) and macOS (launchd) only.\n` +
|
|
||||||
`On ${platform}, run \`arboretum\` manually or set up your own supervisor.`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function parseInstallArgs(argv: string[]): InstallFlags {
|
|
||||||
const { values } = parseArgs({
|
|
||||||
args: argv,
|
|
||||||
options: {
|
|
||||||
port: { type: 'string' },
|
|
||||||
bind: { type: 'string' },
|
|
||||||
'allow-origin': { type: 'string', multiple: true },
|
|
||||||
db: { type: 'string' },
|
|
||||||
'vapid-contact': { type: 'string' },
|
|
||||||
'claude-home': { type: 'string' },
|
|
||||||
'bin-path': { type: 'string' },
|
|
||||||
label: { type: 'string' },
|
|
||||||
'dry-run': { type: 'boolean', default: false },
|
|
||||||
'no-enable': { type: 'boolean', default: false },
|
|
||||||
},
|
|
||||||
strict: true,
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
port: values.port,
|
|
||||||
bind: values.bind,
|
|
||||||
allowOrigin: values['allow-origin'] ?? [],
|
|
||||||
db: values.db,
|
|
||||||
vapidContact: values['vapid-contact'],
|
|
||||||
claudeHome: values['claude-home'],
|
|
||||||
binPath: values['bin-path'],
|
|
||||||
label: values.label ?? LAUNCHD_LABEL,
|
|
||||||
dryRun: values['dry-run'] ?? false,
|
|
||||||
noEnable: values['no-enable'] ?? false,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flags propagés au service : UNIQUEMENT ceux fournis par l'utilisateur (ordre stable,
|
|
||||||
* ExecStart déterministe). On n'ajoute JAMAIS --i-know-this-exposes-a-terminal automatiquement
|
|
||||||
* (cf. modèle de sécurité : un service exposé doit être un choix conscient et explicite).
|
|
||||||
*/
|
|
||||||
export function buildServiceArgs(flags: InstallFlags): string[] {
|
|
||||||
const args: string[] = [];
|
|
||||||
if (flags.port) args.push('--port', flags.port);
|
|
||||||
if (flags.bind) args.push('--bind', flags.bind);
|
|
||||||
for (const origin of flags.allowOrigin) args.push('--allow-origin', origin);
|
|
||||||
if (flags.db) args.push('--db', flags.db);
|
|
||||||
if (flags.vapidContact) args.push('--vapid-contact', flags.vapidContact);
|
|
||||||
if (flags.claudeHome) args.push('--claude-home', flags.claudeHome);
|
|
||||||
return args;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Le `dist/index.js` réellement installé (depuis dist/cli/install.js). */
|
|
||||||
export function resolveScriptPath(): string {
|
|
||||||
return fileURLToPath(new URL('../index.js', import.meta.url));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cible exécutable du service. Par défaut node + script (immunisé contre un PATH minimal sous
|
|
||||||
* systemd/launchd) ; --bin-path force le wrapper `arboretum` global (suit les upgrades npm i -g).
|
|
||||||
*/
|
|
||||||
export function resolveBin(flags: Pick<InstallFlags, 'binPath'>): { exec: string; args: string[] } {
|
|
||||||
if (flags.binPath) return { exec: flags.binPath, args: [] };
|
|
||||||
return { exec: process.execPath, args: [resolveScriptPath()] };
|
|
||||||
}
|
|
||||||
|
|
||||||
export function systemdUnitPath(): string {
|
|
||||||
const configHome = process.env.XDG_CONFIG_HOME ?? join(homedir(), '.config');
|
|
||||||
return join(configHome, 'systemd', 'user', `${SERVICE_NAME}.service`);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function launchAgentPlistPath(label: string): string {
|
|
||||||
return join(homedir(), 'Library', 'LaunchAgents', `${label}.plist`);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function launchdLogPaths(): { dir: string; out: string; err: string } {
|
|
||||||
const dir = join(homedir(), 'Library', 'Logs', 'arboretum');
|
|
||||||
return { dir, out: join(dir, 'out.log'), err: join(dir, 'err.log') };
|
|
||||||
}
|
|
||||||
|
|
||||||
export function xmlEscape(s: string): string {
|
|
||||||
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
||||||
}
|
|
||||||
|
|
||||||
// systemd accepte les doubles quotes dans ExecStart ; on ne quote que les tokens à espaces.
|
|
||||||
function quoteIfNeeded(token: string): string {
|
|
||||||
return /\s/.test(token) ? `"${token}"` : token;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function renderSystemdUnit(input: { exec: string; scriptArgs: string[] }): string {
|
|
||||||
const execStart = [input.exec, ...input.scriptArgs].map(quoteIfNeeded).join(' ');
|
|
||||||
// KillSignal=SIGTERM + TimeoutStopSec=10 collent au drain de runDaemon (SIGTERM → drain 1s → close).
|
|
||||||
return `[Unit]
|
|
||||||
Description=Arboretum — git worktree & Claude Code dashboard
|
|
||||||
After=network-online.target
|
|
||||||
Wants=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=${execStart}
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=5
|
|
||||||
KillSignal=SIGTERM
|
|
||||||
TimeoutStopSec=10
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function renderLaunchAgentPlist(input: {
|
|
||||||
label: string;
|
|
||||||
programArguments: string[];
|
|
||||||
stdoutPath: string;
|
|
||||||
stderrPath: string;
|
|
||||||
}): string {
|
|
||||||
const args = input.programArguments.map((a) => ` <string>${xmlEscape(a)}</string>`).join('\n');
|
|
||||||
// KeepAlive/SuccessfulExit=false ≈ Restart=on-failure (ne relance pas après un drain volontaire).
|
|
||||||
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>Label</key>
|
|
||||||
<string>${xmlEscape(input.label)}</string>
|
|
||||||
<key>ProgramArguments</key>
|
|
||||||
<array>
|
|
||||||
${args}
|
|
||||||
</array>
|
|
||||||
<key>RunAtLoad</key>
|
|
||||||
<true/>
|
|
||||||
<key>KeepAlive</key>
|
|
||||||
<dict>
|
|
||||||
<key>SuccessfulExit</key>
|
|
||||||
<false/>
|
|
||||||
</dict>
|
|
||||||
<key>StandardOutPath</key>
|
|
||||||
<string>${xmlEscape(input.stdoutPath)}</string>
|
|
||||||
<key>StandardErrorPath</key>
|
|
||||||
<string>${xmlEscape(input.stderrPath)}</string>
|
|
||||||
<key>EnvironmentVariables</key>
|
|
||||||
<dict>
|
|
||||||
<key>NODE_ENV</key>
|
|
||||||
<string>production</string>
|
|
||||||
</dict>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function printTokenBanner(token: string, url: string): void {
|
|
||||||
console.log('\n┌──────────────────────────────────────────────────────────────────┐');
|
|
||||||
console.log('│ First start — your access token (shown once, store it safely): │');
|
|
||||||
console.log('└──────────────────────────────────────────────────────────────────┘');
|
|
||||||
console.log(`\n ${token}\n`);
|
|
||||||
console.log(` Login at: ${url}/\n`);
|
|
||||||
}
|
|
||||||
|
|
||||||
export function printUsage(version: string): void {
|
|
||||||
console.log(`Arboretum v${version} — git worktree & Claude Code dashboard
|
|
||||||
|
|
||||||
Usage:
|
|
||||||
arboretum [flags] Start the daemon (default)
|
|
||||||
arboretum serve [flags] Start the daemon (explicit alias)
|
|
||||||
arboretum install [flags] Install & start a user service (systemd on Linux, launchd on macOS)
|
|
||||||
arboretum uninstall Stop & remove the user service
|
|
||||||
arboretum status Show the service status
|
|
||||||
arboretum help Show this help
|
|
||||||
|
|
||||||
Daemon flags:
|
|
||||||
--port <n> Port to listen on (default 7317)
|
|
||||||
--bind <addr> Bind address (default 127.0.0.1)
|
|
||||||
--allow-origin <url> Additional allowed Origin (repeatable)
|
|
||||||
--db <path> SQLite database path
|
|
||||||
--vapid-contact <mailto|url> VAPID contact subject for Web Push
|
|
||||||
--i-know-this-exposes-a-terminal Acknowledge a non-loopback bind (avoid — prefer Tailscale Serve)
|
|
||||||
|
|
||||||
Install flags (daemon flags above are propagated to the service):
|
|
||||||
--bin-path <path> Use this binary in the service instead of node + script
|
|
||||||
--label <id> launchd label (macOS only, default ${LAUNCHD_LABEL})
|
|
||||||
--dry-run Print the unit/plist and commands without applying anything
|
|
||||||
--no-enable Write the service file but do not enable/start it
|
|
||||||
`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ─── Effets de bord (fs + exec) ───────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
function run(cmd: string, args: string[], opts?: { check?: boolean }): number {
|
|
||||||
const res = spawnSync(cmd, args, { stdio: 'inherit' });
|
|
||||||
if (res.error) {
|
|
||||||
if ((res.error as NodeJS.ErrnoException).code === 'ENOENT') {
|
|
||||||
throw new Error(`Command not found: ${cmd}. Is it installed and on your PATH?`);
|
|
||||||
}
|
|
||||||
throw res.error;
|
|
||||||
}
|
|
||||||
const code = res.status ?? 0;
|
|
||||||
if (opts?.check && code !== 0) {
|
|
||||||
throw new Error(`Command failed (exit ${code}): ${cmd} ${args.join(' ')}`);
|
|
||||||
}
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bootstrap du token avec EXACTEMENT les flags du service (même db). Valide aussi le bind
|
|
||||||
* (garde-fou de loadConfig). Affiche le token une fois, puis ferme la db avant que le service
|
|
||||||
* ne l'ouvre. Skippé en --dry-run par l'appelant.
|
|
||||||
*/
|
|
||||||
function bootstrapToken(serviceArgs: string[]): void {
|
|
||||||
const config = loadConfig(serviceArgs);
|
|
||||||
const url = `http://${config.bind === '0.0.0.0' ? '127.0.0.1' : config.bind}:${config.port}`;
|
|
||||||
const db = openDb(config.dbPath);
|
|
||||||
try {
|
|
||||||
const token = new AuthService(db).ensureBootstrapToken();
|
|
||||||
if (token) printTokenBanner(token, url);
|
|
||||||
else console.log('\nAn access token already exists in this database — manage tokens from Settings.\n');
|
|
||||||
} finally {
|
|
||||||
db.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function runInstall(argv: string[]): Promise<void> {
|
|
||||||
const platform = detectPlatform();
|
|
||||||
const flags = parseInstallArgs(argv);
|
|
||||||
const serviceArgs = buildServiceArgs(flags);
|
|
||||||
const { exec, args: binArgs } = resolveBin(flags);
|
|
||||||
const scriptArgs = [...binArgs, ...serviceArgs];
|
|
||||||
|
|
||||||
if (platform === 'linux') {
|
|
||||||
const unit = renderSystemdUnit({ exec, scriptArgs });
|
|
||||||
const unitPath = systemdUnitPath();
|
|
||||||
if (flags.dryRun) {
|
|
||||||
console.log(`# ${unitPath}\n${unit}\n# commands:`);
|
|
||||||
console.log('systemctl --user daemon-reload');
|
|
||||||
if (!flags.noEnable) {
|
|
||||||
console.log(`systemctl --user enable --now ${SERVICE_NAME}`);
|
|
||||||
console.log(`loginctl enable-linger ${process.env.USER ?? '$USER'}`);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
bootstrapToken(serviceArgs);
|
|
||||||
mkdirSync(dirname(unitPath), { recursive: true });
|
|
||||||
writeFileSync(unitPath, unit);
|
|
||||||
console.log(`Wrote ${unitPath}`);
|
|
||||||
run('systemctl', ['--user', 'daemon-reload'], { check: true });
|
|
||||||
if (!flags.noEnable) {
|
|
||||||
run('systemctl', ['--user', 'enable', '--now', SERVICE_NAME], { check: true });
|
|
||||||
// enable-linger best-effort : absent en CI / sans session loginctl, non bloquant.
|
|
||||||
if (run('loginctl', ['enable-linger', process.env.USER ?? '']) !== 0) {
|
|
||||||
console.warn('Warning: could not enable linger — the service may not start at boot.');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log(`\nArboretum service installed. Logs: journalctl --user -u ${SERVICE_NAME} -f`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// macOS (launchd)
|
|
||||||
const logs = launchdLogPaths();
|
|
||||||
const programArguments = [exec, ...scriptArgs];
|
|
||||||
const plist = renderLaunchAgentPlist({
|
|
||||||
label: flags.label,
|
|
||||||
programArguments,
|
|
||||||
stdoutPath: logs.out,
|
|
||||||
stderrPath: logs.err,
|
|
||||||
});
|
|
||||||
const plistPath = launchAgentPlistPath(flags.label);
|
|
||||||
const uid = process.getuid?.() ?? 0;
|
|
||||||
const target = `gui/${uid}/${flags.label}`;
|
|
||||||
if (flags.dryRun) {
|
|
||||||
console.log(`# ${plistPath}\n${plist}\n# commands:`);
|
|
||||||
console.log(`launchctl bootout ${target} # best-effort`);
|
|
||||||
if (!flags.noEnable) {
|
|
||||||
console.log(`launchctl bootstrap gui/${uid} ${plistPath}`);
|
|
||||||
console.log(`launchctl enable ${target}`);
|
|
||||||
console.log(`launchctl kickstart -k ${target}`);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
bootstrapToken(serviceArgs);
|
|
||||||
mkdirSync(dirname(plistPath), { recursive: true });
|
|
||||||
mkdirSync(logs.dir, { recursive: true });
|
|
||||||
writeFileSync(plistPath, plist);
|
|
||||||
console.log(`Wrote ${plistPath}`);
|
|
||||||
if (!flags.noEnable) {
|
|
||||||
run('launchctl', ['bootout', target]); // best-effort : ignore "not loaded" (rend bootstrap idempotent)
|
|
||||||
run('launchctl', ['bootstrap', `gui/${uid}`, plistPath], { check: true });
|
|
||||||
run('launchctl', ['enable', target]);
|
|
||||||
run('launchctl', ['kickstart', '-k', target]);
|
|
||||||
}
|
|
||||||
console.log(`\nArboretum service installed. Logs: ${logs.out}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function runUninstall(argv: string[]): Promise<void> {
|
|
||||||
const platform = detectPlatform();
|
|
||||||
const flags = parseInstallArgs(argv);
|
|
||||||
if (platform === 'linux') {
|
|
||||||
const unitPath = systemdUnitPath();
|
|
||||||
run('systemctl', ['--user', 'disable', '--now', SERVICE_NAME]); // best-effort
|
|
||||||
if (existsSync(unitPath)) {
|
|
||||||
rmSync(unitPath);
|
|
||||||
console.log(`Removed ${unitPath}`);
|
|
||||||
}
|
|
||||||
run('systemctl', ['--user', 'daemon-reload']);
|
|
||||||
console.log('Arboretum service removed.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const plistPath = launchAgentPlistPath(flags.label);
|
|
||||||
const uid = process.getuid?.() ?? 0;
|
|
||||||
run('launchctl', ['bootout', `gui/${uid}/${flags.label}`]); // best-effort
|
|
||||||
if (existsSync(plistPath)) {
|
|
||||||
rmSync(plistPath);
|
|
||||||
console.log(`Removed ${plistPath}`);
|
|
||||||
}
|
|
||||||
console.log('Arboretum service removed.');
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function runStatus(argv: string[]): Promise<void> {
|
|
||||||
const platform = detectPlatform();
|
|
||||||
const flags = parseInstallArgs(argv);
|
|
||||||
if (platform === 'linux') {
|
|
||||||
const code = run('systemctl', ['--user', 'status', SERVICE_NAME, '--no-pager']);
|
|
||||||
console.log(`\nLogs: journalctl --user -u ${SERVICE_NAME} -f`);
|
|
||||||
process.exitCode = code;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const uid = process.getuid?.() ?? 0;
|
|
||||||
const code = run('launchctl', ['print', `gui/${uid}/${flags.label}`]);
|
|
||||||
console.log(`\nLogs: ${launchdLogPaths().out}`);
|
|
||||||
process.exitCode = code;
|
|
||||||
}
|
|
||||||
@@ -17,8 +17,6 @@ export interface Config {
|
|||||||
claudeSessionsDir: string;
|
claudeSessionsDir: string;
|
||||||
/** sujet VAPID des notifications Web Push (mailto: ou URL). */
|
/** sujet VAPID des notifications Web Push (mailto: ou URL). */
|
||||||
vapidContact: string;
|
vapidContact: string;
|
||||||
/** découverte auto des repos au démarrage + périodique (désactivable via --no-discover). */
|
|
||||||
autoDiscover: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadConfig(argv = process.argv.slice(2)): Config {
|
export function loadConfig(argv = process.argv.slice(2)): Config {
|
||||||
@@ -35,8 +33,6 @@ export function loadConfig(argv = process.argv.slice(2)): Config {
|
|||||||
'claude-home': { type: 'string' },
|
'claude-home': { type: 'string' },
|
||||||
// sujet VAPID des notifications push (contact requis par la spec Web Push).
|
// sujet VAPID des notifications push (contact requis par la spec Web Push).
|
||||||
'vapid-contact': { type: 'string' },
|
'vapid-contact': { type: 'string' },
|
||||||
// désactive la découverte auto des repos (boot + périodique) — utilisé par les tests d'acceptation.
|
|
||||||
'no-discover': { type: 'boolean', default: false },
|
|
||||||
},
|
},
|
||||||
strict: true,
|
strict: true,
|
||||||
});
|
});
|
||||||
@@ -64,6 +60,5 @@ export function loadConfig(argv = process.argv.slice(2)): Config {
|
|||||||
claudeProjectsDir: join(claudeHome, 'projects'),
|
claudeProjectsDir: join(claudeHome, 'projects'),
|
||||||
claudeSessionsDir: join(claudeHome, 'sessions'),
|
claudeSessionsDir: join(claudeHome, 'sessions'),
|
||||||
vapidContact: values['vapid-contact'] ?? 'mailto:arboretum@localhost',
|
vapidContact: values['vapid-contact'] ?? 'mailto:arboretum@localhost',
|
||||||
autoDiscover: !(values['no-discover'] ?? false),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,201 +0,0 @@
|
|||||||
// Gestion des groupes de travail (P5) : un groupe = collection nommée de repos (many-to-many).
|
|
||||||
// Membership légère et persistée ; les worktrees/sessions du groupe ne sont PAS stockés ici —
|
|
||||||
// ils restent servis par WorktreeManager/PtyManager et filtrés côté client par repoId.
|
|
||||||
// Tout est synchrone : aucune I/O git/fs, node:sqlite est synchrone.
|
|
||||||
import { EventEmitter } from 'node:events';
|
|
||||||
import { randomUUID } from 'node:crypto';
|
|
||||||
import type { GroupSummary } from '@arboretum/shared';
|
|
||||||
import type { Db } from '../db/index.js';
|
|
||||||
|
|
||||||
const LABEL_MAX = 100;
|
|
||||||
const DESCRIPTION_MAX = 2000;
|
|
||||||
const COLOR_RE = /^#[0-9a-fA-F]{6}$/;
|
|
||||||
|
|
||||||
interface GroupRow {
|
|
||||||
id: string;
|
|
||||||
label: string;
|
|
||||||
description: string | null;
|
|
||||||
color: string | null;
|
|
||||||
position: number;
|
|
||||||
created_at: string;
|
|
||||||
updated_at: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface GroupManagerEvents {
|
|
||||||
group_update: [GroupSummary];
|
|
||||||
group_removed: [string];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Erreur portant un statusCode + code pour mapping HTTP direct par les routes (cf. sendManagerError). */
|
|
||||||
function httpError(statusCode: number, code: string, message: string): Error {
|
|
||||||
return Object.assign(new Error(message), { statusCode, code });
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Valide un label : non vide après trim, borné. */
|
|
||||||
function normLabel(label: unknown): string {
|
|
||||||
if (typeof label !== 'string') throw httpError(400, 'BAD_REQUEST', 'label is required');
|
|
||||||
const v = label.trim();
|
|
||||||
if (v === '') throw httpError(400, 'BAD_REQUEST', 'label must not be empty');
|
|
||||||
if (v.length > LABEL_MAX) throw httpError(400, 'BAD_REQUEST', `label must be at most ${LABEL_MAX} characters`);
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Normalise une description : vide/absente → null, bornée sinon. */
|
|
||||||
function normDescription(description: string | null | undefined): string | null {
|
|
||||||
if (description === null || description === undefined) return null;
|
|
||||||
const v = description.trim();
|
|
||||||
if (v === '') return null;
|
|
||||||
if (v.length > DESCRIPTION_MAX) throw httpError(400, 'BAD_REQUEST', `description must be at most ${DESCRIPTION_MAX} characters`);
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Normalise une couleur : vide/absente → null, doit être un hex `#rrggbb` sinon. */
|
|
||||||
function normColor(color: string | null | undefined): string | null {
|
|
||||||
if (color === null || color === undefined) return null;
|
|
||||||
const v = color.trim();
|
|
||||||
if (v === '') return null;
|
|
||||||
if (!COLOR_RE.test(v)) throw httpError(400, 'BAD_REQUEST', 'color must be a hex string like #4f46e5');
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class GroupManager extends EventEmitter<GroupManagerEvents> {
|
|
||||||
constructor(private readonly db: Db) {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
private getGroupRow(id: string): GroupRow | null {
|
|
||||||
return (this.db.prepare('SELECT * FROM groups WHERE id = ?').get(id) as unknown as GroupRow | undefined) ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private repoIdsFor(groupId: string): string[] {
|
|
||||||
const rows = this.db
|
|
||||||
.prepare('SELECT repo_id FROM group_repos WHERE group_id = ? ORDER BY position ASC, created_at ASC')
|
|
||||||
.all(groupId) as Array<{ repo_id: string }>;
|
|
||||||
return rows.map((r) => r.repo_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
private rowToSummary(row: GroupRow): GroupSummary {
|
|
||||||
return {
|
|
||||||
id: row.id,
|
|
||||||
label: row.label,
|
|
||||||
description: row.description,
|
|
||||||
color: row.color,
|
|
||||||
repoIds: this.repoIdsFor(row.id),
|
|
||||||
createdAt: row.created_at,
|
|
||||||
updatedAt: row.updated_at,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Garde-fou : le repo doit exister (meilleur message que de laisser la FK lever une contrainte opaque). */
|
|
||||||
private assertRepoExists(repoId: string): void {
|
|
||||||
if (typeof repoId !== 'string' || repoId === '') throw httpError(400, 'BAD_REQUEST', 'repoId is required');
|
|
||||||
const exists = this.db.prepare('SELECT 1 FROM repos WHERE id = ?').get(repoId);
|
|
||||||
if (!exists) throw httpError(404, 'REPO_NOT_FOUND', 'No repo with this id');
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Position d'insertion suivante dans un groupe (append en queue). */
|
|
||||||
private nextPosition(groupId: string): number {
|
|
||||||
const row = this.db.prepare('SELECT COALESCE(MAX(position), -1) + 1 AS pos FROM group_repos WHERE group_id = ?').get(groupId) as {
|
|
||||||
pos: number;
|
|
||||||
};
|
|
||||||
return row.pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
listGroups(): GroupSummary[] {
|
|
||||||
const rows = this.db.prepare('SELECT * FROM groups ORDER BY position ASC, created_at ASC').all() as unknown as GroupRow[];
|
|
||||||
return rows.map((r) => this.rowToSummary(r));
|
|
||||||
}
|
|
||||||
|
|
||||||
getGroup(id: string): GroupSummary {
|
|
||||||
const row = this.getGroupRow(id);
|
|
||||||
if (!row) throw httpError(404, 'NOT_FOUND', 'No group with this id');
|
|
||||||
return this.rowToSummary(row);
|
|
||||||
}
|
|
||||||
|
|
||||||
createGroup(opts: { label: string; description?: string; color?: string; repoIds?: string[] }): GroupSummary {
|
|
||||||
const label = normLabel(opts.label);
|
|
||||||
const description = normDescription(opts.description);
|
|
||||||
const color = normColor(opts.color);
|
|
||||||
const repoIds = opts.repoIds ?? [];
|
|
||||||
if (!Array.isArray(repoIds)) throw httpError(400, 'BAD_REQUEST', 'repoIds must be an array');
|
|
||||||
for (const repoId of repoIds) this.assertRepoExists(repoId);
|
|
||||||
|
|
||||||
const now = new Date().toISOString();
|
|
||||||
const id = randomUUID();
|
|
||||||
const position = this.db.prepare('SELECT COALESCE(MAX(position), -1) + 1 AS pos FROM groups').get() as { pos: number };
|
|
||||||
|
|
||||||
this.db.exec('BEGIN');
|
|
||||||
try {
|
|
||||||
this.db
|
|
||||||
.prepare('INSERT INTO groups (id, label, description, color, position, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?)')
|
|
||||||
.run(id, label, description, color, position.pos, now, now);
|
|
||||||
const insertRepo = this.db.prepare('INSERT OR IGNORE INTO group_repos (group_id, repo_id, position, created_at) VALUES (?, ?, ?, ?)');
|
|
||||||
let pos = 0;
|
|
||||||
const seen = new Set<string>();
|
|
||||||
for (const repoId of repoIds) {
|
|
||||||
if (seen.has(repoId)) continue;
|
|
||||||
seen.add(repoId);
|
|
||||||
insertRepo.run(id, repoId, pos++, now);
|
|
||||||
}
|
|
||||||
this.db.exec('COMMIT');
|
|
||||||
} catch (err) {
|
|
||||||
this.db.exec('ROLLBACK');
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
|
|
||||||
const summary = this.getGroup(id);
|
|
||||||
this.emit('group_update', summary);
|
|
||||||
return summary;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateGroup(id: string, patch: { label?: string; description?: string | null; color?: string | null }): GroupSummary {
|
|
||||||
const row = this.getGroupRow(id);
|
|
||||||
if (!row) throw httpError(404, 'NOT_FOUND', 'No group with this id');
|
|
||||||
if (patch.label !== undefined) row.label = normLabel(patch.label);
|
|
||||||
if (patch.description !== undefined) row.description = normDescription(patch.description);
|
|
||||||
if (patch.color !== undefined) row.color = normColor(patch.color);
|
|
||||||
const now = new Date().toISOString();
|
|
||||||
this.db
|
|
||||||
.prepare('UPDATE groups SET label = ?, description = ?, color = ?, updated_at = ? WHERE id = ?')
|
|
||||||
.run(row.label, row.description, row.color, now, id);
|
|
||||||
const summary = this.getGroup(id);
|
|
||||||
this.emit('group_update', summary);
|
|
||||||
return summary;
|
|
||||||
}
|
|
||||||
|
|
||||||
deleteGroup(id: string): boolean {
|
|
||||||
// CASCADE (PRAGMA foreign_keys = ON) purge group_repos.
|
|
||||||
const res = this.db.prepare('DELETE FROM groups WHERE id = ?').run(id);
|
|
||||||
if (res.changes === 0) return false;
|
|
||||||
this.emit('group_removed', id);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
addRepo(groupId: string, repoId: string): GroupSummary {
|
|
||||||
if (!this.getGroupRow(groupId)) throw httpError(404, 'NOT_FOUND', 'No group with this id');
|
|
||||||
this.assertRepoExists(repoId);
|
|
||||||
const now = new Date().toISOString();
|
|
||||||
// INSERT OR IGNORE → idempotent (PRIMARY KEY (group_id, repo_id)).
|
|
||||||
this.db
|
|
||||||
.prepare('INSERT OR IGNORE INTO group_repos (group_id, repo_id, position, created_at) VALUES (?, ?, ?, ?)')
|
|
||||||
.run(groupId, repoId, this.nextPosition(groupId), now);
|
|
||||||
this.touch(groupId, now);
|
|
||||||
const summary = this.getGroup(groupId);
|
|
||||||
this.emit('group_update', summary);
|
|
||||||
return summary;
|
|
||||||
}
|
|
||||||
|
|
||||||
removeRepo(groupId: string, repoId: string): GroupSummary {
|
|
||||||
if (!this.getGroupRow(groupId)) throw httpError(404, 'NOT_FOUND', 'No group with this id');
|
|
||||||
// DELETE no-op si absent → idempotent.
|
|
||||||
this.db.prepare('DELETE FROM group_repos WHERE group_id = ? AND repo_id = ?').run(groupId, repoId);
|
|
||||||
this.touch(groupId, new Date().toISOString());
|
|
||||||
const summary = this.getGroup(groupId);
|
|
||||||
this.emit('group_update', summary);
|
|
||||||
return summary;
|
|
||||||
}
|
|
||||||
|
|
||||||
private touch(groupId: string, now: string): void {
|
|
||||||
this.db.prepare('UPDATE groups SET updated_at = ? WHERE id = ?').run(now, groupId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
// Planificateur de la découverte auto des repos : scan au démarrage + re-scan périodique.
|
|
||||||
// Calqué sur DiscoveryService (sessions) — start()/stop() avec timer .unref(). Démarré depuis
|
|
||||||
// runDaemon() UNIQUEMENT (jamais buildApp), ce qui isole naturellement les tests vitest du scan.
|
|
||||||
// Lui-même sans état : il lit les racines/l'intervalle dans `settings` et délègue à WorktreeManager.
|
|
||||||
import type { Db } from '../db/index.js';
|
|
||||||
import type { WorktreeManager } from './worktree-manager.js';
|
|
||||||
import { readScanIntervalMin, readScanRoots } from './scan-settings.js';
|
|
||||||
|
|
||||||
export class RepoDiscoveryService {
|
|
||||||
private timer: NodeJS.Timeout | null = null;
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private readonly db: Db,
|
|
||||||
private readonly worktrees: WorktreeManager,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
start(): void {
|
|
||||||
if (this.timer) return;
|
|
||||||
void this.refresh(); // scan initial asynchrone : ne bloque pas le boot
|
|
||||||
const intervalMin = readScanIntervalMin(this.db);
|
|
||||||
if (intervalMin > 0) {
|
|
||||||
this.timer = setInterval(() => void this.refresh(), intervalMin * 60_000);
|
|
||||||
this.timer.unref(); // ne maintient pas le process en vie
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stop(): void {
|
|
||||||
if (this.timer) {
|
|
||||||
clearInterval(this.timer);
|
|
||||||
this.timer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Relit les racines (changement effectif sans redémarrage) et lance un scan. Ne lève jamais. */
|
|
||||||
private async refresh(): Promise<void> {
|
|
||||||
try {
|
|
||||||
await this.worktrees.discoverRepos({ roots: readScanRoots(this.db) });
|
|
||||||
} catch {
|
|
||||||
/* scan tolérant : une erreur ne doit pas tuer le timer */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
// Découverte auto des dépôts git : marche bornée du système de fichiers à la recherche de `.git`.
|
|
||||||
// Fonction PURE et tolérante (ne lève jamais) — testable isolément comme parseWorktreePorcelain.
|
|
||||||
// N'appelle JAMAIS git (détection par présence de `.git`) : la validation réelle (isRepo) et la
|
|
||||||
// résolution de default_branch se font paresseusement à l'enregistrement, pas par dépôt scanné.
|
|
||||||
import { readdir } from 'node:fs/promises';
|
|
||||||
import { existsSync } from 'node:fs';
|
|
||||||
import { join } from 'node:path';
|
|
||||||
|
|
||||||
export interface ScanLimits {
|
|
||||||
/** profondeur maximale de descente sous chaque racine (la racine = 0). */
|
|
||||||
maxDepth: number;
|
|
||||||
/** nombre maximal de repos retournés (garde-fou anti-explosion d'un FS pathologique). */
|
|
||||||
maxRepos: number;
|
|
||||||
/** noms de dossiers à ne jamais ouvrir (en plus des dotdirs, toujours exclus). */
|
|
||||||
excludeDirs?: Set<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Dossiers jamais explorés : grosses arborescences sans repos racine, ou bruit de build. */
|
|
||||||
export const DEFAULT_EXCLUDE_DIRS = new Set<string>([
|
|
||||||
'node_modules',
|
|
||||||
'vendor',
|
|
||||||
'target',
|
|
||||||
'dist',
|
|
||||||
'build',
|
|
||||||
'.cache',
|
|
||||||
'venv',
|
|
||||||
'.venv',
|
|
||||||
'__pycache__',
|
|
||||||
]);
|
|
||||||
|
|
||||||
interface Frame {
|
|
||||||
dir: string;
|
|
||||||
depth: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parcours itératif (pile explicite, jamais de récursion non bornée) des `roots`.
|
|
||||||
* Règles :
|
|
||||||
* - un dossier contenant `.git` (fichier OU dossier → couvre les worktrees liés) est un repo :
|
|
||||||
* on l'enregistre et on NE descend PAS dedans (sous-modules/worktrees imbriqués ignorés) ;
|
|
||||||
* - on n'empile que les vrais sous-dossiers (`d.isDirectory()`), donc les symlinks ne sont PAS
|
|
||||||
* suivis (anti-cycle + anti-sortie de racine), et on saute dotdirs + excludeDirs ;
|
|
||||||
* - bornes : `maxDepth`, `maxRepos`, et un éventuel `signal` (timeout global) ;
|
|
||||||
* - tolérance : un `readdir` qui échoue (EACCES/ENOENT) est ignoré, le scan continue ;
|
|
||||||
* - racine inexistante/illisible : ignorée silencieusement.
|
|
||||||
* Retourne les chemins absolus dédupliqués des racines de repos, et `truncated` si une borne a coupé.
|
|
||||||
*/
|
|
||||||
export async function scanForRepos(
|
|
||||||
roots: string[],
|
|
||||||
limits: ScanLimits,
|
|
||||||
signal?: AbortSignal,
|
|
||||||
): Promise<{ paths: string[]; truncated: boolean }> {
|
|
||||||
const excludes = limits.excludeDirs ?? DEFAULT_EXCLUDE_DIRS;
|
|
||||||
const found = new Set<string>();
|
|
||||||
const seen = new Set<string>(); // ceinture-bretelles anti-cycle (chemins déjà visités)
|
|
||||||
let truncated = false;
|
|
||||||
|
|
||||||
// pile partagée entre toutes les racines : un seul plafond global maxRepos.
|
|
||||||
const stack: Frame[] = [];
|
|
||||||
for (const root of roots) stack.push({ dir: root, depth: 0 });
|
|
||||||
|
|
||||||
while (stack.length > 0) {
|
|
||||||
if (signal?.aborted || found.size >= limits.maxRepos) {
|
|
||||||
truncated = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
const { dir, depth } = stack.pop() as Frame;
|
|
||||||
if (seen.has(dir)) continue;
|
|
||||||
seen.add(dir);
|
|
||||||
|
|
||||||
// un repo : on l'enregistre et on ne descend pas.
|
|
||||||
if (existsSync(join(dir, '.git'))) {
|
|
||||||
found.add(dir);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (depth >= limits.maxDepth) continue;
|
|
||||||
|
|
||||||
let entries;
|
|
||||||
try {
|
|
||||||
entries = await readdir(dir, { withFileTypes: true });
|
|
||||||
} catch {
|
|
||||||
continue; // EACCES/ENOENT/… : dossier ignoré, on poursuit
|
|
||||||
}
|
|
||||||
for (const e of entries) {
|
|
||||||
if (!e.isDirectory()) continue; // symlinks non suivis (isDirectory() est false pour un lien)
|
|
||||||
if (e.name.startsWith('.') || excludes.has(e.name)) continue;
|
|
||||||
stack.push({ dir: join(dir, e.name), depth: depth + 1 });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return { paths: [...found], truncated };
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
// Réglages de la découverte auto des repos, persistés dans la table `settings` (clé/valeur).
|
|
||||||
// Frontière de sécurité : ces clés sont NON sensibles et n'entrent dans l'allow-list du PATCH
|
|
||||||
// /api/v1/settings que via les validateurs ci-dessous. Aucun secret ne transite par ici.
|
|
||||||
import { homedir } from 'node:os';
|
|
||||||
import { getSetting } from '../db/index.js';
|
|
||||||
import type { Db } from '../db/index.js';
|
|
||||||
import { isSafeAbsolutePath } from './git.js';
|
|
||||||
|
|
||||||
export const SCAN_ROOTS_KEY = 'scan_roots';
|
|
||||||
export const SCAN_INTERVAL_KEY = 'scan_interval_min';
|
|
||||||
|
|
||||||
/** Intervalle par défaut du re-scan périodique (minutes). 0 = désactivé. */
|
|
||||||
export const DEFAULT_SCAN_INTERVAL_MIN = 5;
|
|
||||||
/** Borne haute de l'intervalle (24 h) et nombre maximal de racines. */
|
|
||||||
export const MAX_SCAN_INTERVAL_MIN = 1440;
|
|
||||||
export const MAX_SCAN_ROOTS = 16;
|
|
||||||
|
|
||||||
/** Racines à scanner. Défaut : le home de l'utilisateur. Lecture tolérante (JSON malformé → défaut). */
|
|
||||||
export function readScanRoots(db: Db): string[] {
|
|
||||||
const raw = getSetting(db, SCAN_ROOTS_KEY);
|
|
||||||
if (!raw) return [homedir()];
|
|
||||||
const parsed = normalizeScanRoots(safeParse(raw));
|
|
||||||
return parsed && parsed.length > 0 ? parsed : [homedir()];
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Intervalle périodique en minutes (0 = désactivé). Défaut DEFAULT_SCAN_INTERVAL_MIN. */
|
|
||||||
export function readScanIntervalMin(db: Db): number {
|
|
||||||
const raw = getSetting(db, SCAN_INTERVAL_KEY);
|
|
||||||
if (raw === null) return DEFAULT_SCAN_INTERVAL_MIN;
|
|
||||||
const n = Number(raw);
|
|
||||||
return Number.isInteger(n) && n >= 0 && n <= MAX_SCAN_INTERVAL_MIN ? n : DEFAULT_SCAN_INTERVAL_MIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Valide/normalise une liste de racines : tableau de chemins absolus normalisés (isSafeAbsolutePath),
|
|
||||||
* jamais `/` (scan catastrophique), dédupliqués, ≤ MAX_SCAN_ROOTS. Retourne null si invalide (⇒ 400).
|
|
||||||
* Une liste vide est valide (revient au défaut côté lecture).
|
|
||||||
*/
|
|
||||||
export function normalizeScanRoots(raw: unknown): string[] | null {
|
|
||||||
if (!Array.isArray(raw)) return null;
|
|
||||||
if (raw.length > MAX_SCAN_ROOTS) return null;
|
|
||||||
const out: string[] = [];
|
|
||||||
for (const item of raw) {
|
|
||||||
if (typeof item !== 'string') return null;
|
|
||||||
const p = item.trim();
|
|
||||||
if (!isSafeAbsolutePath(p) || p === '/') return null;
|
|
||||||
if (!out.includes(p)) out.push(p);
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Valide un intervalle (entier 0–MAX_SCAN_INTERVAL_MIN). Retourne null si invalide. */
|
|
||||||
export function normalizeScanIntervalMin(raw: unknown): number | null {
|
|
||||||
if (typeof raw !== 'number' || !Number.isInteger(raw)) return null;
|
|
||||||
if (raw < 0 || raw > MAX_SCAN_INTERVAL_MIN) return null;
|
|
||||||
return raw;
|
|
||||||
}
|
|
||||||
|
|
||||||
function safeParse(raw: string): unknown {
|
|
||||||
try {
|
|
||||||
return JSON.parse(raw);
|
|
||||||
} catch {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,6 @@ import { randomUUID } from 'node:crypto';
|
|||||||
import { basename, dirname, join, resolve } from 'node:path';
|
import { basename, dirname, join, resolve } from 'node:path';
|
||||||
import { existsSync } from 'node:fs';
|
import { existsSync } from 'node:fs';
|
||||||
import type {
|
import type {
|
||||||
DiscoverReposResponse,
|
|
||||||
HookRunResult,
|
HookRunResult,
|
||||||
PostCreateHook,
|
PostCreateHook,
|
||||||
RepoSummary,
|
RepoSummary,
|
||||||
@@ -18,7 +17,6 @@ import type {
|
|||||||
import type { Db } from '../db/index.js';
|
import type { Db } from '../db/index.js';
|
||||||
import type { PtyManager } from './pty-manager.js';
|
import type { PtyManager } from './pty-manager.js';
|
||||||
import { DiscoveryService, mergeSessions } from './discovery-service.js';
|
import { DiscoveryService, mergeSessions } from './discovery-service.js';
|
||||||
import { scanForRepos } from './repo-scanner.js';
|
|
||||||
import { preTrustProject } from './claude-trust.js';
|
import { preTrustProject } from './claude-trust.js';
|
||||||
import {
|
import {
|
||||||
addWorktree,
|
addWorktree,
|
||||||
@@ -37,10 +35,6 @@ import {
|
|||||||
const FACTS_TTL_MS = 2500;
|
const FACTS_TTL_MS = 2500;
|
||||||
const HOOK_TIMEOUT_MS = 5 * 60_000;
|
const HOOK_TIMEOUT_MS = 5 * 60_000;
|
||||||
const HOOK_OUTPUT_MAX = 64 * 1024;
|
const HOOK_OUTPUT_MAX = 64 * 1024;
|
||||||
// Bornes du scan de découverte (anti-explosion sur un home volumineux).
|
|
||||||
const SCAN_MAX_DEPTH = 6;
|
|
||||||
const SCAN_MAX_REPOS = 2000;
|
|
||||||
const SCAN_TIMEOUT_MS = 30_000;
|
|
||||||
|
|
||||||
interface RepoRow {
|
interface RepoRow {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -50,7 +44,6 @@ interface RepoRow {
|
|||||||
post_create_hooks: string;
|
post_create_hooks: string;
|
||||||
pre_trust: number;
|
pre_trust: number;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
hidden: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorktreeManagerEvents {
|
export interface WorktreeManagerEvents {
|
||||||
@@ -103,8 +96,6 @@ function runHook(cwd: string, hook: PostCreateHook): Promise<HookRunResult> {
|
|||||||
export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
||||||
private readonly factsCache = new Map<string, { facts: Array<{ w: ParsedWorktree; status: WorktreeGitStatus }>; at: number }>();
|
private readonly factsCache = new Map<string, { facts: Array<{ w: ParsedWorktree; status: WorktreeGitStatus }>; at: number }>();
|
||||||
private readonly locks = new Map<string, Promise<unknown>>();
|
private readonly locks = new Map<string, Promise<unknown>>();
|
||||||
/** Scan de découverte en cours : coalesce boot + bouton + périodique sur un seul scan. */
|
|
||||||
private scanInFlight: Promise<DiscoverReposResponse> | null = null;
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly db: Db,
|
private readonly db: Db,
|
||||||
@@ -130,7 +121,6 @@ export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
|||||||
preTrust: row.pre_trust === 1,
|
preTrust: row.pre_trust === 1,
|
||||||
createdAt: row.created_at,
|
createdAt: row.created_at,
|
||||||
valid: await isRepo(row.path),
|
valid: await isRepo(row.path),
|
||||||
hidden: row.hidden === 1,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,35 +143,24 @@ export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
|||||||
post_create_hooks: JSON.stringify(opts.postCreateHooks ?? []),
|
post_create_hooks: JSON.stringify(opts.postCreateHooks ?? []),
|
||||||
pre_trust: opts.preTrust ? 1 : 0,
|
pre_trust: opts.preTrust ? 1 : 0,
|
||||||
created_at: new Date().toISOString(),
|
created_at: new Date().toISOString(),
|
||||||
hidden: 0,
|
|
||||||
};
|
};
|
||||||
try {
|
|
||||||
this.db
|
this.db
|
||||||
.prepare('INSERT INTO repos (id, path, label, default_branch, post_create_hooks, pre_trust, created_at, hidden) VALUES (?, ?, ?, ?, ?, ?, ?, ?)')
|
.prepare('INSERT INTO repos (id, path, label, default_branch, post_create_hooks, pre_trust, created_at) VALUES (?, ?, ?, ?, ?, ?, ?)')
|
||||||
.run(row.id, row.path, row.label, row.default_branch, row.post_create_hooks, row.pre_trust, row.created_at, row.hidden);
|
.run(row.id, row.path, row.label, row.default_branch, row.post_create_hooks, row.pre_trust, row.created_at);
|
||||||
} catch (err) {
|
|
||||||
// Course possible avec un scan concurrent qui aurait inséré le même path entre le SELECT
|
|
||||||
// d'unicité et cet INSERT (contrainte UNIQUE sur path) → on rend le même 409 explicite.
|
|
||||||
if (String((err as { code?: string }).code).includes('CONSTRAINT')) {
|
|
||||||
throw httpError(409, 'ALREADY_REGISTERED', 'This repository is already registered');
|
|
||||||
}
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
const summary = await this.rowToSummary(row);
|
const summary = await this.rowToSummary(row);
|
||||||
this.emit('repo_update', summary);
|
this.emit('repo_update', summary);
|
||||||
return summary;
|
return summary;
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateRepo(id: string, patch: { label?: string; postCreateHooks?: PostCreateHook[]; preTrust?: boolean; hidden?: boolean }): Promise<RepoSummary> {
|
async updateRepo(id: string, patch: { label?: string; postCreateHooks?: PostCreateHook[]; preTrust?: boolean }): Promise<RepoSummary> {
|
||||||
const row = this.getRepoRow(id);
|
const row = this.getRepoRow(id);
|
||||||
if (!row) throw httpError(404, 'NOT_FOUND', 'No repo with this id');
|
if (!row) throw httpError(404, 'NOT_FOUND', 'No repo with this id');
|
||||||
if (patch.label !== undefined) row.label = patch.label.trim() || row.label;
|
if (patch.label !== undefined) row.label = patch.label.trim() || row.label;
|
||||||
if (patch.postCreateHooks !== undefined) row.post_create_hooks = JSON.stringify(patch.postCreateHooks);
|
if (patch.postCreateHooks !== undefined) row.post_create_hooks = JSON.stringify(patch.postCreateHooks);
|
||||||
if (patch.preTrust !== undefined) row.pre_trust = patch.preTrust ? 1 : 0;
|
if (patch.preTrust !== undefined) row.pre_trust = patch.preTrust ? 1 : 0;
|
||||||
if (patch.hidden !== undefined) row.hidden = patch.hidden ? 1 : 0;
|
|
||||||
this.db
|
this.db
|
||||||
.prepare('UPDATE repos SET label = ?, post_create_hooks = ?, pre_trust = ?, hidden = ? WHERE id = ?')
|
.prepare('UPDATE repos SET label = ?, post_create_hooks = ?, pre_trust = ? WHERE id = ?')
|
||||||
.run(row.label, row.post_create_hooks, row.pre_trust, row.hidden, id);
|
.run(row.label, row.post_create_hooks, row.pre_trust, id);
|
||||||
const summary = await this.rowToSummary(row);
|
const summary = await this.rowToSummary(row);
|
||||||
this.emit('repo_update', summary);
|
this.emit('repo_update', summary);
|
||||||
return summary;
|
return summary;
|
||||||
@@ -195,53 +174,6 @@ export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Découvre les repos git sous `roots` et auto-enregistre les NOUVEAUX (path absent de la DB).
|
|
||||||
* Idempotent et anti-résurrection : un path déjà présent — visible OU masqué — n'est jamais
|
|
||||||
* réécrit (INSERT ... ON CONFLICT DO NOTHING). Les scans concurrents sont coalescés. Tolérant :
|
|
||||||
* ne lève pas (le scanner avale les erreurs FS). N'appelle aucun git pendant le scan
|
|
||||||
* (default_branch=NULL, résolu paresseusement par rowToSummary à l'affichage).
|
|
||||||
*/
|
|
||||||
discoverRepos(opts: { roots: string[]; maxDepth?: number; maxRepos?: number }): Promise<DiscoverReposResponse> {
|
|
||||||
if (this.scanInFlight) return this.scanInFlight;
|
|
||||||
this.scanInFlight = this.runDiscovery(opts).finally(() => {
|
|
||||||
this.scanInFlight = null;
|
|
||||||
});
|
|
||||||
return this.scanInFlight;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async runDiscovery(opts: { roots: string[]; maxDepth?: number; maxRepos?: number }): Promise<DiscoverReposResponse> {
|
|
||||||
const t0 = Date.now();
|
|
||||||
const { paths, truncated } = await scanForRepos(
|
|
||||||
opts.roots,
|
|
||||||
{ maxDepth: opts.maxDepth ?? SCAN_MAX_DEPTH, maxRepos: opts.maxRepos ?? SCAN_MAX_REPOS },
|
|
||||||
AbortSignal.timeout(SCAN_TIMEOUT_MS),
|
|
||||||
);
|
|
||||||
const insert = this.db.prepare(
|
|
||||||
`INSERT INTO repos (id, path, label, default_branch, post_create_hooks, pre_trust, created_at, hidden)
|
|
||||||
VALUES (?, ?, ?, NULL, '[]', 0, ?, 0) ON CONFLICT(path) DO NOTHING`,
|
|
||||||
);
|
|
||||||
let added = 0;
|
|
||||||
for (const path of paths) {
|
|
||||||
const row: RepoRow = {
|
|
||||||
id: randomUUID(),
|
|
||||||
path,
|
|
||||||
label: basename(path),
|
|
||||||
default_branch: null,
|
|
||||||
post_create_hooks: '[]',
|
|
||||||
pre_trust: 0,
|
|
||||||
created_at: new Date().toISOString(),
|
|
||||||
hidden: 0,
|
|
||||||
};
|
|
||||||
const res = insert.run(row.id, row.path, row.label, row.created_at);
|
|
||||||
if (res.changes === 1) {
|
|
||||||
added++;
|
|
||||||
this.emit('repo_update', await this.rowToSummary(row)); // nouveaux uniquement
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return { scanned: paths.length, added, durationMs: Date.now() - t0, truncated };
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- worktrees ----
|
// ---- worktrees ----
|
||||||
|
|
||||||
/** Sessions (managées + découvertes) dont le cwd correspond à ce chemin de worktree. */
|
/** Sessions (managées + découvertes) dont le cwd correspond à ce chemin de worktree. */
|
||||||
@@ -282,13 +214,8 @@ export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async listAllWorktrees(): Promise<WorktreeSummary[]> {
|
async listAllWorktrees(): Promise<WorktreeSummary[]> {
|
||||||
// Les repos masqués sont exclus du dashboard : inutile de calculer leurs worktrees (sous-process
|
const rows = this.db.prepare('SELECT id FROM repos ORDER BY created_at ASC').all() as Array<{ id: string }>;
|
||||||
// git par repo). Le front charge paresseusement ceux d'un repo masqué via listRepoWorktrees
|
const lists = await Promise.all(rows.map((r) => this.listRepoWorktrees(r.id)));
|
||||||
// quand l'utilisateur active « afficher les masqués ».
|
|
||||||
const rows = this.db.prepare('SELECT id FROM repos WHERE hidden = 0 ORDER BY created_at ASC').all() as Array<{ id: string }>;
|
|
||||||
// Tolérance par repo : avec la découverte auto, un repo douteux (git en échec, chemin disparu,
|
|
||||||
// permission) ne doit JAMAIS faire planter tout l'endpoint — il ne contribue alors aucun worktree.
|
|
||||||
const lists = await Promise.all(rows.map((r) => this.listRepoWorktrees(r.id).catch(() => [])));
|
|
||||||
return lists.flat();
|
return lists.flat();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,37 +68,6 @@ const MIGRATIONS: Array<{ id: number; sql: string }> = [
|
|||||||
CREATE INDEX idx_push_subs_token ON push_subscriptions(token_id);
|
CREATE INDEX idx_push_subs_token ON push_subscriptions(token_id);
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
// P5 — groupes de travail. Un groupe = collection de repos (many-to-many).
|
|
||||||
// Worktrees/sessions NON persistés ici : servis par WorktreeManager/PtyManager
|
|
||||||
// et filtrés côté client par repoId. CASCADE s'appuie sur PRAGMA foreign_keys = ON (cf. openDb).
|
|
||||||
id: 5,
|
|
||||||
sql: `
|
|
||||||
CREATE TABLE groups (
|
|
||||||
id TEXT PRIMARY KEY,
|
|
||||||
label TEXT NOT NULL,
|
|
||||||
description TEXT,
|
|
||||||
color TEXT,
|
|
||||||
position INTEGER NOT NULL DEFAULT 0,
|
|
||||||
created_at TEXT NOT NULL,
|
|
||||||
updated_at TEXT NOT NULL
|
|
||||||
);
|
|
||||||
CREATE TABLE group_repos (
|
|
||||||
group_id TEXT NOT NULL REFERENCES groups(id) ON DELETE CASCADE,
|
|
||||||
repo_id TEXT NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
|
|
||||||
position INTEGER NOT NULL DEFAULT 0,
|
|
||||||
created_at TEXT NOT NULL,
|
|
||||||
PRIMARY KEY (group_id, repo_id)
|
|
||||||
);
|
|
||||||
CREATE INDEX idx_group_repos_repo ON group_repos(repo_id);
|
|
||||||
`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
// Découverte auto : un repo masqué reste en DB (exclu du dashboard) pour qu'un
|
|
||||||
// re-scan ne le ressuscite pas. hidden=1 = masqué.
|
|
||||||
id: 6,
|
|
||||||
sql: `ALTER TABLE repos ADD COLUMN hidden INTEGER NOT NULL DEFAULT 0;`,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export type Db = DatabaseSync;
|
export type Db = DatabaseSync;
|
||||||
|
|||||||
@@ -2,30 +2,32 @@
|
|||||||
import { readFileSync } from 'node:fs';
|
import { readFileSync } from 'node:fs';
|
||||||
import { join, dirname } from 'node:path';
|
import { join, dirname } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { loadConfig, type Config } from './config.js';
|
import { loadConfig } from './config.js';
|
||||||
import { openDb } from './db/index.js';
|
import { openDb } from './db/index.js';
|
||||||
import { buildApp } from './app.js';
|
import { buildApp } from './app.js';
|
||||||
import { runInstall, runUninstall, runStatus, printUsage, printTokenBanner } from './cli/install.js';
|
|
||||||
|
|
||||||
const pkg = JSON.parse(
|
const pkg = JSON.parse(
|
||||||
readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8'),
|
readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8'),
|
||||||
) as { version: string };
|
) as { version: string };
|
||||||
|
|
||||||
/** Démarre le daemon : écoute HTTP, scan des sessions, drain propre au SIGTERM/SIGINT. */
|
async function main(): Promise<void> {
|
||||||
export async function runDaemon(config: Config): Promise<void> {
|
const config = loadConfig();
|
||||||
const db = openDb(config.dbPath);
|
const db = openDb(config.dbPath);
|
||||||
const { app, auth, manager, discovery, repoDiscovery } = buildApp(config, db, pkg.version);
|
const { app, auth, manager, discovery } = buildApp(config, db, pkg.version);
|
||||||
|
|
||||||
const bootstrapToken = auth.ensureBootstrapToken();
|
const bootstrapToken = auth.ensureBootstrapToken();
|
||||||
await app.listen({ port: config.port, host: config.bind });
|
await app.listen({ port: config.port, host: config.bind });
|
||||||
discovery.start(); // scan initial + rafraîchissement périodique des sessions découvertes
|
discovery.start(); // scan initial + rafraîchissement périodique des sessions découvertes
|
||||||
if (config.autoDiscover) repoDiscovery.start(); // découverte auto des repos : scan au boot + re-scan périodique
|
|
||||||
|
|
||||||
const url = `http://${config.bind === '0.0.0.0' ? '127.0.0.1' : config.bind}:${config.port}`;
|
const url = `http://${config.bind === '0.0.0.0' ? '127.0.0.1' : config.bind}:${config.port}`;
|
||||||
app.log.info(`Arboretum v${pkg.version} — ${url}`);
|
app.log.info(`Arboretum v${pkg.version} — ${url}`);
|
||||||
if (bootstrapToken) {
|
if (bootstrapToken) {
|
||||||
// Affiché une seule fois : le hash seul est stocké.
|
// Affiché une seule fois : le hash seul est stocké.
|
||||||
printTokenBanner(bootstrapToken, url);
|
console.log('\n┌──────────────────────────────────────────────────────────────────┐');
|
||||||
|
console.log('│ First start — your access token (shown once, store it safely): │');
|
||||||
|
console.log('└──────────────────────────────────────────────────────────────────┘');
|
||||||
|
console.log(`\n ${bootstrapToken}\n`);
|
||||||
|
console.log(` Login at: ${url}/\n`);
|
||||||
} else if (config.printToken) {
|
} else if (config.printToken) {
|
||||||
console.log('Tokens are stored hashed and cannot be re-printed. Create a new one from Settings (or reset the db).');
|
console.log('Tokens are stored hashed and cannot be re-printed. Create a new one from Settings (or reset the db).');
|
||||||
}
|
}
|
||||||
@@ -36,7 +38,6 @@ export async function runDaemon(config: Config): Promise<void> {
|
|||||||
shuttingDown = true;
|
shuttingDown = true;
|
||||||
app.log.info(`${signal} received — draining sessions then exiting`);
|
app.log.info(`${signal} received — draining sessions then exiting`);
|
||||||
discovery.stop();
|
discovery.stop();
|
||||||
repoDiscovery.stop();
|
|
||||||
manager.shutdown();
|
manager.shutdown();
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
void app.close().then(() => process.exit(0));
|
void app.close().then(() => process.exit(0));
|
||||||
@@ -46,36 +47,6 @@ export async function runDaemon(config: Config): Promise<void> {
|
|||||||
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
process.on('SIGTERM', () => shutdown('SIGTERM'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Routeur de sous-commandes. On inspecte argv[0] AVANT loadConfig (parseArgs strict throw sur
|
|
||||||
// un positionnel inconnu). Aucune sous-commande (ou un flag en tête) → daemon : rétrocompat stricte
|
|
||||||
// de `arboretum`, `arboretum --port 8080`, `npx @johanleroy/git-arboretum --allow-origin …`.
|
|
||||||
async function main(): Promise<void> {
|
|
||||||
const argv = process.argv.slice(2);
|
|
||||||
const cmd = argv[0];
|
|
||||||
switch (cmd) {
|
|
||||||
case 'install':
|
|
||||||
return runInstall(argv.slice(1));
|
|
||||||
case 'uninstall':
|
|
||||||
return runUninstall(argv.slice(1));
|
|
||||||
case 'status':
|
|
||||||
return runStatus(argv.slice(1));
|
|
||||||
case 'serve':
|
|
||||||
return runDaemon(loadConfig(argv.slice(1)));
|
|
||||||
case 'help':
|
|
||||||
case '--help':
|
|
||||||
case '-h':
|
|
||||||
printUsage(pkg.version);
|
|
||||||
return;
|
|
||||||
default:
|
|
||||||
if (cmd && !cmd.startsWith('-')) {
|
|
||||||
console.error(`Unknown command: ${cmd}\n`);
|
|
||||||
printUsage(pkg.version);
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
return runDaemon(loadConfig(argv));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
main().catch((err) => {
|
main().catch((err) => {
|
||||||
console.error(err instanceof Error ? err.message : err);
|
console.error(err instanceof Error ? err.message : err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
@@ -1,23 +1,7 @@
|
|||||||
import type { FastifyInstance, FastifyRequest } from 'fastify';
|
import type { FastifyInstance } from 'fastify';
|
||||||
import type {
|
import type { LoginRequest, LoginResponse, MeResponse } from '@arboretum/shared';
|
||||||
CreateTokenRequest,
|
|
||||||
CreateTokenResponse,
|
|
||||||
LoginRequest,
|
|
||||||
LoginResponse,
|
|
||||||
MeResponse,
|
|
||||||
TokensListResponse,
|
|
||||||
} from '@arboretum/shared';
|
|
||||||
import type { AuthService, LoginRateLimiter } from '../auth/service.js';
|
import type { AuthService, LoginRateLimiter } from '../auth/service.js';
|
||||||
|
|
||||||
// Tailscale Serve / un reverse-proxy TLS posent x-forwarded-proto. On ne sert jamais
|
|
||||||
// en TLS direct : `secure` n'est posé que derrière un front HTTPS, jamais en localhost http
|
|
||||||
// (sinon le navigateur refuserait le cookie sur http://127.0.0.1 et le login local casserait).
|
|
||||||
function isHttpsRequest(req: FastifyRequest): boolean {
|
|
||||||
const xfp = req.headers['x-forwarded-proto'];
|
|
||||||
const proto = (Array.isArray(xfp) ? xfp[0] : xfp)?.split(',')[0]?.trim();
|
|
||||||
return proto === 'https';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function registerAuthRoutes(
|
export function registerAuthRoutes(
|
||||||
app: FastifyInstance,
|
app: FastifyInstance,
|
||||||
auth: AuthService,
|
auth: AuthService,
|
||||||
@@ -40,7 +24,6 @@ export function registerAuthRoutes(
|
|||||||
path: '/',
|
path: '/',
|
||||||
httpOnly: true,
|
httpOnly: true,
|
||||||
sameSite: 'strict',
|
sameSite: 'strict',
|
||||||
secure: isHttpsRequest(req),
|
|
||||||
maxAge: 30 * 24 * 3600,
|
maxAge: 30 * 24 * 3600,
|
||||||
});
|
});
|
||||||
const res: LoginResponse = { ok: true, label: ctx.label };
|
const res: LoginResponse = { ok: true, label: ctx.label };
|
||||||
@@ -48,49 +31,12 @@ export function registerAuthRoutes(
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.get('/api/v1/auth/me', async (req, reply) => {
|
app.get('/api/v1/auth/me', async (req, reply) => {
|
||||||
const res: MeResponse = {
|
const res: MeResponse = { ok: true, tokenLabel: req.authContext?.label ?? 'unknown', serverVersion };
|
||||||
ok: true,
|
|
||||||
tokenId: req.authContext?.tokenId ?? '',
|
|
||||||
tokenLabel: req.authContext?.label ?? 'unknown',
|
|
||||||
serverVersion,
|
|
||||||
};
|
|
||||||
return reply.send(res);
|
return reply.send(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/api/v1/auth/logout', async (req, reply) => {
|
app.post('/api/v1/auth/logout', async (_req, reply) => {
|
||||||
// Les attributs doivent matcher ceux posés au login pour que le navigateur efface bien le cookie.
|
void reply.clearCookie(auth.cookieName, { path: '/' });
|
||||||
void reply.clearCookie(auth.cookieName, { path: '/', secure: isHttpsRequest(req) });
|
|
||||||
return reply.send({ ok: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
// ---- Gestion des tokens d'accès (onglet Réglages) ----
|
|
||||||
// Sous l'auth globale (preValidation). On ne renvoie jamais le hash ; la valeur en clair
|
|
||||||
// d'un nouveau token n'est exposée qu'une seule fois, à la création.
|
|
||||||
app.get('/api/v1/auth/tokens', async (req): Promise<TokensListResponse> => {
|
|
||||||
const current = req.authContext?.tokenId;
|
|
||||||
return { tokens: auth.listTokens().map((t) => ({ ...t, current: t.id === current })) };
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post('/api/v1/auth/tokens', async (req, reply) => {
|
|
||||||
const body = req.body as Partial<CreateTokenRequest> | null;
|
|
||||||
const label = typeof body?.label === 'string' ? body.label.trim() : '';
|
|
||||||
if (label.length < 1 || label.length > 64) {
|
|
||||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'label must be 1–64 characters' } });
|
|
||||||
}
|
|
||||||
const { id, token } = auth.createTokenRecord(label);
|
|
||||||
return reply.status(201).send({ id, label, token } satisfies CreateTokenResponse);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.delete('/api/v1/auth/tokens/:id', async (req, reply) => {
|
|
||||||
const { id } = req.params as { id: string };
|
|
||||||
const result = auth.revokeToken(id);
|
|
||||||
if (result === 'not_found') {
|
|
||||||
return reply.status(404).send({ error: { code: 'NOT_FOUND', message: 'No active token with this id' } });
|
|
||||||
}
|
|
||||||
if (result === 'last') {
|
|
||||||
return reply.status(409).send({ error: { code: 'LAST_TOKEN', message: 'Cannot revoke the last active token' } });
|
|
||||||
}
|
|
||||||
// 200 + corps JSON (pas 204) : le mini-client REST du front parse toujours la réponse.
|
|
||||||
return reply.send({ ok: true });
|
return reply.send({ ok: true });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
import type { FastifyInstance } from 'fastify';
|
|
||||||
import { readdir, stat } from 'node:fs/promises';
|
|
||||||
import { existsSync } from 'node:fs';
|
|
||||||
import { homedir } from 'node:os';
|
|
||||||
import { join, dirname, resolve } from 'node:path';
|
|
||||||
import type { FsEntry, FsListResponse } from '@arboretum/shared';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Navigation du système de fichiers pour le sélecteur de dossier côté web.
|
|
||||||
* Ne renvoie QUE des noms de sous-dossiers (jamais de contenu de fichier) ; authentifié
|
|
||||||
* par le hook preValidation global comme tout /api/**. Un utilisateur authentifié dispose
|
|
||||||
* déjà d'un terminal (RCE par conception) : lister des dossiers n'élargit pas le modèle de menace.
|
|
||||||
*
|
|
||||||
* GET /api/v1/fs/list?path=<abs>&markRepos=1&showHidden=1
|
|
||||||
* - path absent → home de l'utilisateur
|
|
||||||
* - markRepos → annote les sous-dossiers qui sont des dépôts git (présence d'un `.git`)
|
|
||||||
* - showHidden → inclut les dotfiles (masqués par défaut)
|
|
||||||
*/
|
|
||||||
export function registerFsRoutes(app: FastifyInstance): void {
|
|
||||||
app.get('/api/v1/fs/list', async (req, reply) => {
|
|
||||||
const q = req.query as { path?: string; markRepos?: string; showHidden?: string };
|
|
||||||
const raw = q.path && q.path.length > 0 ? q.path : homedir();
|
|
||||||
if (!raw.startsWith('/')) {
|
|
||||||
return reply.status(400).send({ error: { code: 'BAD_PATH', message: 'path must be absolute' } });
|
|
||||||
}
|
|
||||||
// resolve() normalise et clampe à la racine : aucun échappement d'arborescence via `..`.
|
|
||||||
const abs = resolve(raw);
|
|
||||||
|
|
||||||
let st;
|
|
||||||
try {
|
|
||||||
st = await stat(abs);
|
|
||||||
} catch (err) {
|
|
||||||
const code = (err as NodeJS.ErrnoException).code;
|
|
||||||
if (code === 'ENOENT') return reply.status(404).send({ error: { code: 'NOT_FOUND', message: `No such directory: ${abs}` } });
|
|
||||||
if (code === 'EACCES') return reply.status(403).send({ error: { code: 'FORBIDDEN', message: `Permission denied: ${abs}` } });
|
|
||||||
return reply.status(400).send({ error: { code: 'BAD_PATH', message: (err as Error).message } });
|
|
||||||
}
|
|
||||||
if (!st.isDirectory()) {
|
|
||||||
return reply.status(400).send({ error: { code: 'NOT_A_DIRECTORY', message: `Not a directory: ${abs}` } });
|
|
||||||
}
|
|
||||||
|
|
||||||
const markRepos = q.markRepos === '1' || q.markRepos === 'true';
|
|
||||||
const showHidden = q.showHidden === '1' || q.showHidden === 'true';
|
|
||||||
|
|
||||||
let dirents;
|
|
||||||
try {
|
|
||||||
dirents = await readdir(abs, { withFileTypes: true });
|
|
||||||
} catch (err) {
|
|
||||||
const code = (err as NodeJS.ErrnoException).code;
|
|
||||||
if (code === 'EACCES') return reply.status(403).send({ error: { code: 'FORBIDDEN', message: `Permission denied: ${abs}` } });
|
|
||||||
return reply.status(400).send({ error: { code: 'BAD_PATH', message: (err as Error).message } });
|
|
||||||
}
|
|
||||||
|
|
||||||
const entries: FsEntry[] = [];
|
|
||||||
for (const d of dirents) {
|
|
||||||
if (!showHidden && d.name.startsWith('.')) continue;
|
|
||||||
let isDir = d.isDirectory();
|
|
||||||
// symlink éventuel vers un dossier : résolu par stat (tolérant aux liens cassés).
|
|
||||||
if (!isDir && d.isSymbolicLink()) {
|
|
||||||
try {
|
|
||||||
isDir = (await stat(join(abs, d.name))).isDirectory();
|
|
||||||
} catch {
|
|
||||||
isDir = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!isDir) continue;
|
|
||||||
const full = join(abs, d.name);
|
|
||||||
const entry: FsEntry = { name: d.name, path: full };
|
|
||||||
if (markRepos && existsSync(join(full, '.git'))) entry.isRepo = true;
|
|
||||||
entries.push(entry);
|
|
||||||
}
|
|
||||||
entries.sort((a, b) => a.name.toLowerCase().localeCompare(b.name.toLowerCase()));
|
|
||||||
|
|
||||||
const res: FsListResponse = {
|
|
||||||
path: abs,
|
|
||||||
parent: abs === '/' ? null : dirname(abs),
|
|
||||||
home: homedir(),
|
|
||||||
entries,
|
|
||||||
};
|
|
||||||
return reply.send(res);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
import type { FastifyInstance } from 'fastify';
|
|
||||||
import type {
|
|
||||||
AddRepoRequest,
|
|
||||||
CreateGroupRequest,
|
|
||||||
GroupResponse,
|
|
||||||
GroupsListResponse,
|
|
||||||
UpdateGroupRequest,
|
|
||||||
} from '@arboretum/shared';
|
|
||||||
import type { GroupManager } from '../core/group-manager.js';
|
|
||||||
import { sendManagerError } from './repos.js';
|
|
||||||
|
|
||||||
export function registerGroupRoutes(app: FastifyInstance, gm: GroupManager): void {
|
|
||||||
app.get('/api/v1/groups', async (): Promise<GroupsListResponse> => ({ groups: gm.listGroups() }));
|
|
||||||
|
|
||||||
app.get('/api/v1/groups/:id', async (req, reply) => {
|
|
||||||
const { id } = req.params as { id: string };
|
|
||||||
try {
|
|
||||||
return reply.send({ group: gm.getGroup(id) } satisfies GroupResponse);
|
|
||||||
} catch (err) {
|
|
||||||
return sendManagerError(reply, err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post('/api/v1/groups', async (req, reply) => {
|
|
||||||
const body = req.body as Partial<CreateGroupRequest> | null;
|
|
||||||
if (!body || typeof body.label !== 'string') {
|
|
||||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'label is required' } });
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const group = gm.createGroup({
|
|
||||||
label: body.label,
|
|
||||||
...(body.description !== undefined ? { description: body.description } : {}),
|
|
||||||
...(body.color !== undefined ? { color: body.color } : {}),
|
|
||||||
...(Array.isArray(body.repoIds) ? { repoIds: body.repoIds } : {}),
|
|
||||||
});
|
|
||||||
return reply.status(201).send({ group } satisfies GroupResponse);
|
|
||||||
} catch (err) {
|
|
||||||
return sendManagerError(reply, err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.patch('/api/v1/groups/:id', async (req, reply) => {
|
|
||||||
const { id } = req.params as { id: string };
|
|
||||||
const body = (req.body as Partial<UpdateGroupRequest> | null) ?? {};
|
|
||||||
try {
|
|
||||||
const group = gm.updateGroup(id, {
|
|
||||||
...(body.label !== undefined ? { label: body.label } : {}),
|
|
||||||
...(body.description !== undefined ? { description: body.description } : {}),
|
|
||||||
...(body.color !== undefined ? { color: body.color } : {}),
|
|
||||||
});
|
|
||||||
return reply.send({ group } satisfies GroupResponse);
|
|
||||||
} catch (err) {
|
|
||||||
return sendManagerError(reply, err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.delete('/api/v1/groups/:id', async (req, reply) => {
|
|
||||||
const { id } = req.params as { id: string };
|
|
||||||
if (!gm.deleteGroup(id)) {
|
|
||||||
return reply.status(404).send({ error: { code: 'NOT_FOUND', message: 'No group with this id' } });
|
|
||||||
}
|
|
||||||
return reply.send({ ok: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post('/api/v1/groups/:id/repos', async (req, reply) => {
|
|
||||||
const { id } = req.params as { id: string };
|
|
||||||
const body = req.body as Partial<AddRepoRequest> | null;
|
|
||||||
if (!body || typeof body.repoId !== 'string') {
|
|
||||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'repoId is required' } });
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return reply.send({ group: gm.addRepo(id, body.repoId) } satisfies GroupResponse);
|
|
||||||
} catch (err) {
|
|
||||||
return sendManagerError(reply, err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.delete('/api/v1/groups/:id/repos/:repoId', async (req, reply) => {
|
|
||||||
const { id, repoId } = req.params as { id: string; repoId: string };
|
|
||||||
try {
|
|
||||||
return reply.send({ group: gm.removeRepo(id, repoId) } satisfies GroupResponse);
|
|
||||||
} catch (err) {
|
|
||||||
return sendManagerError(reply, err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
import type { FastifyInstance, FastifyReply } from 'fastify';
|
import type { FastifyInstance, FastifyReply } from 'fastify';
|
||||||
import type { CreateRepoRequest, DiscoverReposResponse, RepoResponse, ReposListResponse, UpdateRepoRequest } from '@arboretum/shared';
|
import type { CreateRepoRequest, RepoResponse, ReposListResponse, UpdateRepoRequest } from '@arboretum/shared';
|
||||||
import type { WorktreeManager } from '../core/worktree-manager.js';
|
import type { WorktreeManager } from '../core/worktree-manager.js';
|
||||||
import type { Db } from '../db/index.js';
|
|
||||||
import { readScanRoots } from '../core/scan-settings.js';
|
|
||||||
|
|
||||||
/** Mappe une erreur du manager (statusCode + code) vers une réponse REST normalisée. */
|
/** Mappe une erreur du manager (statusCode + code) vers une réponse REST normalisée. */
|
||||||
export function sendManagerError(reply: FastifyReply, err: unknown): FastifyReply {
|
export function sendManagerError(reply: FastifyReply, err: unknown): FastifyReply {
|
||||||
@@ -10,19 +8,9 @@ export function sendManagerError(reply: FastifyReply, err: unknown): FastifyRepl
|
|||||||
return reply.status(e.statusCode ?? 500).send({ error: { code: e.code ?? 'INTERNAL', message: e.message ?? 'Internal error' } });
|
return reply.status(e.statusCode ?? 500).send({ error: { code: e.code ?? 'INTERNAL', message: e.message ?? 'Internal error' } });
|
||||||
}
|
}
|
||||||
|
|
||||||
export function registerRepoRoutes(app: FastifyInstance, wt: WorktreeManager, db: Db): void {
|
export function registerRepoRoutes(app: FastifyInstance, wt: WorktreeManager): void {
|
||||||
app.get('/api/v1/repos', async (): Promise<ReposListResponse> => ({ repos: await wt.listRepos() }));
|
app.get('/api/v1/repos', async (): Promise<ReposListResponse> => ({ repos: await wt.listRepos() }));
|
||||||
|
|
||||||
// Scan manuel : découvre et auto-enregistre les repos sous les racines configurées (settings).
|
|
||||||
app.post('/api/v1/repos/discover', async (_req, reply) => {
|
|
||||||
try {
|
|
||||||
const res: DiscoverReposResponse = await wt.discoverRepos({ roots: readScanRoots(db) });
|
|
||||||
return reply.send(res);
|
|
||||||
} catch (err) {
|
|
||||||
return sendManagerError(reply, err);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
app.post('/api/v1/repos', async (req, reply) => {
|
app.post('/api/v1/repos', async (req, reply) => {
|
||||||
const body = req.body as Partial<CreateRepoRequest> | null;
|
const body = req.body as Partial<CreateRepoRequest> | null;
|
||||||
if (!body || typeof body.path !== 'string') {
|
if (!body || typeof body.path !== 'string') {
|
||||||
@@ -50,7 +38,6 @@ export function registerRepoRoutes(app: FastifyInstance, wt: WorktreeManager, db
|
|||||||
...(body.label !== undefined ? { label: body.label } : {}),
|
...(body.label !== undefined ? { label: body.label } : {}),
|
||||||
...(body.postCreateHooks !== undefined ? { postCreateHooks: body.postCreateHooks } : {}),
|
...(body.postCreateHooks !== undefined ? { postCreateHooks: body.postCreateHooks } : {}),
|
||||||
...(body.preTrust !== undefined ? { preTrust: body.preTrust } : {}),
|
...(body.preTrust !== undefined ? { preTrust: body.preTrust } : {}),
|
||||||
...(typeof body.hidden === 'boolean' ? { hidden: body.hidden } : {}),
|
|
||||||
});
|
});
|
||||||
const res: RepoResponse = { repo };
|
const res: RepoResponse = { repo };
|
||||||
return reply.send(res);
|
return reply.send(res);
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
// Réglages exposés à l'UI (onglet Réglages). Frontière de sécurité CENTRALE : la table `settings`
|
|
||||||
// contient aussi des SECRETS (server_secret, vapid_private). Ces routes n'exposent QUE des champs
|
|
||||||
// non sensibles et n'écrivent QUE des clés explicitement allow-listées — jamais les secrets.
|
|
||||||
import type { FastifyInstance } from 'fastify';
|
|
||||||
import type { ServerInfo, SettingsResponse, UpdateSettingsRequest } from '@arboretum/shared';
|
|
||||||
import type { Config } from '../config.js';
|
|
||||||
import { type Db, getSetting, setSetting } from '../db/index.js';
|
|
||||||
import type { PushService } from '../core/push-service.js';
|
|
||||||
import {
|
|
||||||
SCAN_INTERVAL_KEY,
|
|
||||||
SCAN_ROOTS_KEY,
|
|
||||||
normalizeScanIntervalMin,
|
|
||||||
normalizeScanRoots,
|
|
||||||
readScanIntervalMin,
|
|
||||||
readScanRoots,
|
|
||||||
} from '../core/scan-settings.js';
|
|
||||||
|
|
||||||
// Clés de `settings` modifiables via l'API (allow-list stricte). Les secrets ne figurent JAMAIS ici.
|
|
||||||
const GITEA_URL_KEY = 'gitea_url';
|
|
||||||
|
|
||||||
/** Valide/normalise une URL Gitea : http(s) uniquement (anti-XSS sur le href de l'icône). */
|
|
||||||
function normalizeGiteaUrl(raw: string): string | null {
|
|
||||||
const trimmed = raw.trim();
|
|
||||||
if (trimmed === '') return null;
|
|
||||||
let url: URL;
|
|
||||||
try {
|
|
||||||
url = new URL(trimmed);
|
|
||||||
} catch {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (url.protocol !== 'http:' && url.protocol !== 'https:') return null;
|
|
||||||
return url.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function registerSettingsRoutes(
|
|
||||||
app: FastifyInstance,
|
|
||||||
db: Db,
|
|
||||||
config: Config,
|
|
||||||
serverVersion: string,
|
|
||||||
push: PushService,
|
|
||||||
): void {
|
|
||||||
// '' (effacé) est normalisé en null côté réponse.
|
|
||||||
const readGiteaUrl = (): string | null => getSetting(db, GITEA_URL_KEY) || null;
|
|
||||||
const serverInfo = (): ServerInfo => ({
|
|
||||||
version: serverVersion,
|
|
||||||
port: config.port,
|
|
||||||
bind: config.bind,
|
|
||||||
allowedOrigins: config.allowedOrigins,
|
|
||||||
dataDir: config.dataDir,
|
|
||||||
vapidPublicKey: push.publicKey() || null,
|
|
||||||
vapidContact: config.vapidContact,
|
|
||||||
});
|
|
||||||
const snapshot = (): SettingsResponse => ({
|
|
||||||
settings: {
|
|
||||||
giteaUrl: readGiteaUrl(),
|
|
||||||
scanRoots: readScanRoots(db),
|
|
||||||
scanIntervalMin: readScanIntervalMin(db),
|
|
||||||
},
|
|
||||||
server: serverInfo(),
|
|
||||||
});
|
|
||||||
|
|
||||||
app.get('/api/v1/settings', async (): Promise<SettingsResponse> => snapshot());
|
|
||||||
|
|
||||||
app.patch('/api/v1/settings', async (req, reply) => {
|
|
||||||
const body = (req.body as Partial<UpdateSettingsRequest> | null) ?? {};
|
|
||||||
if ('giteaUrl' in body) {
|
|
||||||
const v = body.giteaUrl;
|
|
||||||
if (v === null || v === '') {
|
|
||||||
setSetting(db, GITEA_URL_KEY, ''); // effacement
|
|
||||||
} else if (typeof v === 'string') {
|
|
||||||
const normalized = normalizeGiteaUrl(v);
|
|
||||||
if (!normalized) {
|
|
||||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'giteaUrl must be a valid http(s) URL' } });
|
|
||||||
}
|
|
||||||
setSetting(db, GITEA_URL_KEY, normalized);
|
|
||||||
} else {
|
|
||||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'giteaUrl must be a string or null' } });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ('scanRoots' in body) {
|
|
||||||
const roots = normalizeScanRoots(body.scanRoots);
|
|
||||||
if (!roots) {
|
|
||||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'scanRoots must be an array of ≤16 absolute, normalized paths (never "/")' } });
|
|
||||||
}
|
|
||||||
setSetting(db, SCAN_ROOTS_KEY, JSON.stringify(roots));
|
|
||||||
}
|
|
||||||
if ('scanIntervalMin' in body) {
|
|
||||||
const interval = normalizeScanIntervalMin(body.scanIntervalMin);
|
|
||||||
if (interval === null) {
|
|
||||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'scanIntervalMin must be an integer between 0 and 1440' } });
|
|
||||||
}
|
|
||||||
setSetting(db, SCAN_INTERVAL_KEY, String(interval));
|
|
||||||
}
|
|
||||||
return reply.send(snapshot());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,6 @@ import {
|
|||||||
PROTOCOL_VERSION,
|
PROTOCOL_VERSION,
|
||||||
encodeBinaryFrame,
|
encodeBinaryFrame,
|
||||||
parseClientMessage,
|
parseClientMessage,
|
||||||
type GroupSummary,
|
|
||||||
type RepoSummary,
|
type RepoSummary,
|
||||||
type ServerMessage,
|
type ServerMessage,
|
||||||
type SessionSummary,
|
type SessionSummary,
|
||||||
@@ -14,7 +13,6 @@ import {
|
|||||||
import type { ClientBinding, PtyManager } from '../core/pty-manager.js';
|
import type { ClientBinding, PtyManager } from '../core/pty-manager.js';
|
||||||
import type { DiscoveryService } from '../core/discovery-service.js';
|
import type { DiscoveryService } from '../core/discovery-service.js';
|
||||||
import type { WorktreeManager } from '../core/worktree-manager.js';
|
import type { WorktreeManager } from '../core/worktree-manager.js';
|
||||||
import type { GroupManager } from '../core/group-manager.js';
|
|
||||||
|
|
||||||
const HEARTBEAT_MS = 30_000;
|
const HEARTBEAT_MS = 30_000;
|
||||||
|
|
||||||
@@ -28,7 +26,6 @@ export function registerWsGateway(
|
|||||||
manager: PtyManager,
|
manager: PtyManager,
|
||||||
discovery: DiscoveryService,
|
discovery: DiscoveryService,
|
||||||
worktrees: WorktreeManager,
|
worktrees: WorktreeManager,
|
||||||
groups: GroupManager,
|
|
||||||
serverVersion: string,
|
serverVersion: string,
|
||||||
): void {
|
): void {
|
||||||
app.get('/ws', { websocket: true }, (socket: WebSocket, req) => {
|
app.get('/ws', { websocket: true }, (socket: WebSocket, req) => {
|
||||||
@@ -38,7 +35,6 @@ export function registerWsGateway(
|
|||||||
let helloDone = false;
|
let helloDone = false;
|
||||||
let subscribedSessions = false;
|
let subscribedSessions = false;
|
||||||
let subscribedWorktrees = false;
|
let subscribedWorktrees = false;
|
||||||
let subscribedGroups = false;
|
|
||||||
let alive = true;
|
let alive = true;
|
||||||
|
|
||||||
const send = (msg: ServerMessage): void => {
|
const send = (msg: ServerMessage): void => {
|
||||||
@@ -70,12 +66,6 @@ export function registerWsGateway(
|
|||||||
const onWorktreeRemoved = (e: { repoId: string; path: string }): void => {
|
const onWorktreeRemoved = (e: { repoId: string; path: string }): void => {
|
||||||
if (subscribedWorktrees) send({ type: 'worktree_removed', ...e });
|
if (subscribedWorktrees) send({ type: 'worktree_removed', ...e });
|
||||||
};
|
};
|
||||||
const onGroupUpdate = (group: GroupSummary): void => {
|
|
||||||
if (subscribedGroups) send({ type: 'group_update', group });
|
|
||||||
};
|
|
||||||
const onGroupRemoved = (groupId: string): void => {
|
|
||||||
if (subscribedGroups) send({ type: 'group_removed', groupId });
|
|
||||||
};
|
|
||||||
manager.on('session_update', onSessionUpdate);
|
manager.on('session_update', onSessionUpdate);
|
||||||
manager.on('session_exit', onSessionExit);
|
manager.on('session_exit', onSessionExit);
|
||||||
discovery.on('discovery_update', onDiscoveryUpdate);
|
discovery.on('discovery_update', onDiscoveryUpdate);
|
||||||
@@ -83,8 +73,6 @@ export function registerWsGateway(
|
|||||||
worktrees.on('repo_removed', onRepoRemoved);
|
worktrees.on('repo_removed', onRepoRemoved);
|
||||||
worktrees.on('worktree_update', onWorktreeUpdate);
|
worktrees.on('worktree_update', onWorktreeUpdate);
|
||||||
worktrees.on('worktree_removed', onWorktreeRemoved);
|
worktrees.on('worktree_removed', onWorktreeRemoved);
|
||||||
groups.on('group_update', onGroupUpdate);
|
|
||||||
groups.on('group_removed', onGroupRemoved);
|
|
||||||
|
|
||||||
const heartbeat = setInterval(() => {
|
const heartbeat = setInterval(() => {
|
||||||
if (!alive) {
|
if (!alive) {
|
||||||
@@ -123,7 +111,6 @@ export function registerWsGateway(
|
|||||||
case 'sub': {
|
case 'sub': {
|
||||||
subscribedSessions = msg.topics.includes('sessions');
|
subscribedSessions = msg.topics.includes('sessions');
|
||||||
subscribedWorktrees = msg.topics.includes('worktrees');
|
subscribedWorktrees = msg.topics.includes('worktrees');
|
||||||
subscribedGroups = msg.topics.includes('groups');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case 'attach': {
|
case 'attach': {
|
||||||
@@ -215,8 +202,6 @@ export function registerWsGateway(
|
|||||||
worktrees.off('repo_removed', onRepoRemoved);
|
worktrees.off('repo_removed', onRepoRemoved);
|
||||||
worktrees.off('worktree_update', onWorktreeUpdate);
|
worktrees.off('worktree_update', onWorktreeUpdate);
|
||||||
worktrees.off('worktree_removed', onWorktreeRemoved);
|
worktrees.off('worktree_removed', onWorktreeRemoved);
|
||||||
groups.off('group_update', onGroupUpdate);
|
|
||||||
groups.off('group_removed', onGroupRemoved);
|
|
||||||
for (const [, st] of channels) manager.detach(st.sessionId, st.binding);
|
for (const [, st] of channels) manager.detach(st.sessionId, st.binding);
|
||||||
channels.clear();
|
channels.clear();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import { openDb, type Db } from '../src/db/index.js';
|
|||||||
import { munge } from '../src/core/jsonl-discovery.js';
|
import { munge } from '../src/core/jsonl-discovery.js';
|
||||||
import { readProcStart } from '../src/core/session-registry.js';
|
import { readProcStart } from '../src/core/session-registry.js';
|
||||||
import type { Config } from '../src/config.js';
|
import type { Config } from '../src/config.js';
|
||||||
import type { DiscoverReposResponse, RepoResponse, ReposListResponse } from '@arboretum/shared';
|
|
||||||
|
|
||||||
// resolveClaudeBin() fait `which claude` : on le stub pour ne pas dépendre d'un claude réel en PATH.
|
// resolveClaudeBin() fait `which claude` : on le stub pour ne pas dépendre d'un claude réel en PATH.
|
||||||
vi.mock('node:child_process', () => ({ execFileSync: () => '/usr/bin/claude\n' }));
|
vi.mock('node:child_process', () => ({ execFileSync: () => '/usr/bin/claude\n' }));
|
||||||
@@ -92,25 +91,9 @@ describe('app e2e — auth, origin et sessions', () => {
|
|||||||
expect(cookie).toBeDefined();
|
expect(cookie).toBeDefined();
|
||||||
expect(cookie?.httpOnly).toBe(true);
|
expect(cookie?.httpOnly).toBe(true);
|
||||||
expect(cookie?.sameSite).toBe('Strict');
|
expect(cookie?.sameSite).toBe('Strict');
|
||||||
// Login local (http, pas de x-forwarded-proto) → pas de Secure, sinon le cookie casserait en localhost.
|
|
||||||
expect(cookie?.secure).toBeFalsy();
|
|
||||||
cookieValue = cookie!.value;
|
cookieValue = cookie!.value;
|
||||||
});
|
});
|
||||||
|
|
||||||
it('cookie Secure posé derrière un front HTTPS (x-forwarded-proto)', async () => {
|
|
||||||
const res = await t.bundle.app.inject({
|
|
||||||
method: 'POST',
|
|
||||||
url: '/api/v1/auth/login',
|
|
||||||
headers: { 'x-forwarded-proto': 'https' },
|
|
||||||
payload: { token: t.token },
|
|
||||||
});
|
|
||||||
expect(res.statusCode).toBe(200);
|
|
||||||
const cookie = res.cookies.find((c) => c.name === 'arb_session');
|
|
||||||
expect(cookie?.secure).toBe(true);
|
|
||||||
expect(cookie?.httpOnly).toBe(true);
|
|
||||||
expect(cookie?.sameSite).toBe('Strict');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('routes API sans auth → 401', async () => {
|
it('routes API sans auth → 401', async () => {
|
||||||
for (const url of ['/api/v1/sessions', '/api/v1/auth/me']) {
|
for (const url of ['/api/v1/sessions', '/api/v1/auth/me']) {
|
||||||
const res = await t.bundle.app.inject({ method: 'GET', url });
|
const res = await t.bundle.app.inject({ method: 'GET', url });
|
||||||
@@ -128,8 +111,7 @@ describe('app e2e — auth, origin et sessions', () => {
|
|||||||
cookies: { arb_session: cookieValue },
|
cookies: { arb_session: cookieValue },
|
||||||
});
|
});
|
||||||
expect(me.statusCode).toBe(200);
|
expect(me.statusCode).toBe(200);
|
||||||
expect(me.json()).toMatchObject({ ok: true, tokenLabel: 'initial', serverVersion: '0.0.0-test' });
|
expect(me.json()).toEqual({ ok: true, tokenLabel: 'initial', serverVersion: '0.0.0-test' });
|
||||||
expect(typeof (me.json() as { tokenId: string }).tokenId).toBe('string');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('cookie altéré → 401', async () => {
|
it('cookie altéré → 401', async () => {
|
||||||
@@ -355,59 +337,3 @@ describe('app e2e — découverte, resume & fork (P2)', () => {
|
|||||||
expect(fork.statusCode).toBe(201);
|
expect(fork.statusCode).toBe(201);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('app e2e — découverte auto des repos & masquage', () => {
|
|
||||||
let t: TestApp;
|
|
||||||
let scanRoot: string;
|
|
||||||
const bearer = (): Record<string, string> => ({ authorization: `Bearer ${t.token}` });
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
t = makeApp('repos-discover');
|
|
||||||
// un « repo » côté scanner = un dossier avec .git (le scanner ne lance pas git).
|
|
||||||
scanRoot = join(dir, 'scan-root');
|
|
||||||
mkdirSync(join(scanRoot, 'alpha', '.git'), { recursive: true });
|
|
||||||
mkdirSync(join(scanRoot, 'beta', '.git'), { recursive: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('POST /repos/discover enregistre les repos sous les racines configurées', async () => {
|
|
||||||
// configure la racine de scan via l'allow-list settings, désactive le périodique
|
|
||||||
const patch = await t.bundle.app.inject({
|
|
||||||
method: 'PATCH',
|
|
||||||
url: '/api/v1/settings',
|
|
||||||
headers: bearer(),
|
|
||||||
payload: { scanRoots: [scanRoot], scanIntervalMin: 0 },
|
|
||||||
});
|
|
||||||
expect(patch.statusCode).toBe(200);
|
|
||||||
|
|
||||||
const disc = await t.bundle.app.inject({ method: 'POST', url: '/api/v1/repos/discover', headers: bearer() });
|
|
||||||
expect(disc.statusCode).toBe(200);
|
|
||||||
const body = disc.json() as DiscoverReposResponse;
|
|
||||||
expect(body.added).toBe(2);
|
|
||||||
expect(body.scanned).toBe(2);
|
|
||||||
|
|
||||||
const list = await t.bundle.app.inject({ method: 'GET', url: '/api/v1/repos', headers: bearer() });
|
|
||||||
const repos = (list.json() as ReposListResponse).repos;
|
|
||||||
expect(repos.map((r) => r.label).sort()).toEqual(['alpha', 'beta']);
|
|
||||||
expect(repos.every((r) => r.hidden === false)).toBe(true);
|
|
||||||
|
|
||||||
// re-scan : idempotent (aucun nouveau)
|
|
||||||
const disc2 = await t.bundle.app.inject({ method: 'POST', url: '/api/v1/repos/discover', headers: bearer() });
|
|
||||||
expect((disc2.json() as DiscoverReposResponse).added).toBe(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('PATCH /repos/:id { hidden } masque le repo', async () => {
|
|
||||||
const list = await t.bundle.app.inject({ method: 'GET', url: '/api/v1/repos', headers: bearer() });
|
|
||||||
const repo = (list.json() as ReposListResponse).repos[0];
|
|
||||||
const patch = await t.bundle.app.inject({
|
|
||||||
method: 'PATCH',
|
|
||||||
url: `/api/v1/repos/${repo.id}`,
|
|
||||||
headers: bearer(),
|
|
||||||
payload: { hidden: true },
|
|
||||||
});
|
|
||||||
expect(patch.statusCode).toBe(200);
|
|
||||||
expect((patch.json() as RepoResponse).repo.hidden).toBe(true);
|
|
||||||
// toujours listé (les masqués restent récupérables) mais avec hidden=true
|
|
||||||
const after = await t.bundle.app.inject({ method: 'GET', url: '/api/v1/repos', headers: bearer() });
|
|
||||||
expect((after.json() as ReposListResponse).repos.find((r) => r.id === repo.id)?.hidden).toBe(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,143 +0,0 @@
|
|||||||
// Gestion des tokens d'accès via l'API REST (onglet Réglages) : create → list → revoke,
|
|
||||||
// flag « courant », jamais de hash exposé, garde anti lock-out sur le dernier token.
|
|
||||||
import { mkdtempSync, rmSync } from 'node:fs';
|
|
||||||
import { tmpdir } from 'node:os';
|
|
||||||
import { join } from 'node:path';
|
|
||||||
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
|
|
||||||
import { buildApp, type AppBundle } from '../src/app.js';
|
|
||||||
import { openDb, type Db } from '../src/db/index.js';
|
|
||||||
import type { Config } from '../src/config.js';
|
|
||||||
import type { CreateTokenResponse, MeResponse, TokensListResponse } from '@arboretum/shared';
|
|
||||||
|
|
||||||
// Mêmes stubs que les autres tests de routes : pas de vrai claude ni de vrai PTY.
|
|
||||||
vi.mock('node:child_process', () => ({ execFileSync: () => '/usr/bin/claude\n' }));
|
|
||||||
vi.mock('@homebridge/node-pty-prebuilt-multiarch', () => {
|
|
||||||
class FakePty {
|
|
||||||
pid = 424242;
|
|
||||||
write = vi.fn();
|
|
||||||
resize = vi.fn();
|
|
||||||
pause = vi.fn();
|
|
||||||
resume = vi.fn();
|
|
||||||
kill = vi.fn();
|
|
||||||
onData(): { dispose: () => void } {
|
|
||||||
return { dispose: () => {} };
|
|
||||||
}
|
|
||||||
onExit(): { dispose: () => void } {
|
|
||||||
return { dispose: () => {} };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return { default: { spawn: (): FakePty => new FakePty() } };
|
|
||||||
});
|
|
||||||
|
|
||||||
process.env.ARBORETUM_LOG = 'silent';
|
|
||||||
|
|
||||||
let dir: string;
|
|
||||||
let bundle: AppBundle;
|
|
||||||
let db: Db;
|
|
||||||
let token: string;
|
|
||||||
|
|
||||||
const auth = (): { authorization: string } => ({ authorization: `Bearer ${token}` });
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
dir = mkdtempSync(join(tmpdir(), 'arboretum-tokens-'));
|
|
||||||
const dbPath = join(dir, 'tokens.db');
|
|
||||||
db = openDb(dbPath);
|
|
||||||
const config: Config = {
|
|
||||||
port: 7317,
|
|
||||||
bind: '127.0.0.1',
|
|
||||||
dbPath,
|
|
||||||
dataDir: dir,
|
|
||||||
allowedOrigins: [],
|
|
||||||
printToken: false,
|
|
||||||
claudeProjectsDir: join(dir, 'claude', 'projects'),
|
|
||||||
claudeSessionsDir: join(dir, 'claude', 'sessions'),
|
|
||||||
vapidContact: 'mailto:test@localhost',
|
|
||||||
};
|
|
||||||
bundle = buildApp(config, db, '0.0.0-test');
|
|
||||||
const t = bundle.auth.ensureBootstrapToken();
|
|
||||||
if (!t) throw new Error('bootstrap token attendu sur une base vierge');
|
|
||||||
token = t;
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async () => {
|
|
||||||
await bundle.app.close();
|
|
||||||
db.close();
|
|
||||||
rmSync(dir, { recursive: true, force: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('routes de gestion des tokens', () => {
|
|
||||||
it('GET /auth/me expose le tokenId courant', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/auth/me', headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(200);
|
|
||||||
const me = res.json() as MeResponse;
|
|
||||||
expect(typeof me.tokenId).toBe('string');
|
|
||||||
expect(me.tokenId.length).toBeGreaterThan(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('liste le token initial et le marque « courant », sans jamais exposer de hash', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/auth/tokens', headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(200);
|
|
||||||
const body = res.json() as TokensListResponse;
|
|
||||||
expect(body.tokens).toHaveLength(1);
|
|
||||||
expect(body.tokens[0]?.label).toBe('initial');
|
|
||||||
expect(body.tokens[0]?.current).toBe(true);
|
|
||||||
// aucune fuite de hash / valeur en clair
|
|
||||||
expect(JSON.stringify(body)).not.toMatch(/token_hash|tokenHash/);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('crée un token (valeur en clair renvoyée une fois), puis utilisable pour s’authentifier', async () => {
|
|
||||||
const res = await bundle.app.inject({
|
|
||||||
method: 'POST',
|
|
||||||
url: '/api/v1/auth/tokens',
|
|
||||||
headers: auth(),
|
|
||||||
payload: { label: 'laptop' },
|
|
||||||
});
|
|
||||||
expect(res.statusCode).toBe(201);
|
|
||||||
const created = res.json() as CreateTokenResponse;
|
|
||||||
expect(created.label).toBe('laptop');
|
|
||||||
expect(created.token).toMatch(/^arb_[0-9a-f]{48}$/);
|
|
||||||
|
|
||||||
// le nouveau token authentifie réellement
|
|
||||||
const me = await bundle.app.inject({
|
|
||||||
method: 'GET',
|
|
||||||
url: '/api/v1/auth/me',
|
|
||||||
headers: { authorization: `Bearer ${created.token}` },
|
|
||||||
});
|
|
||||||
expect((me.json() as MeResponse).tokenLabel).toBe('laptop');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('rejette un label vide ou trop long (400)', async () => {
|
|
||||||
const empty = await bundle.app.inject({ method: 'POST', url: '/api/v1/auth/tokens', headers: auth(), payload: { label: ' ' } });
|
|
||||||
expect(empty.statusCode).toBe(400);
|
|
||||||
const tooLong = await bundle.app.inject({ method: 'POST', url: '/api/v1/auth/tokens', headers: auth(), payload: { label: 'x'.repeat(65) } });
|
|
||||||
expect(tooLong.statusCode).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('révoque un token non courant (204), qui disparaît de la liste et n’authentifie plus', async () => {
|
|
||||||
const before = (await bundle.app.inject({ method: 'GET', url: '/api/v1/auth/tokens', headers: auth() })).json() as TokensListResponse;
|
|
||||||
const victim = before.tokens.find((t) => !t.current);
|
|
||||||
expect(victim).toBeDefined();
|
|
||||||
const del = await bundle.app.inject({ method: 'DELETE', url: `/api/v1/auth/tokens/${victim!.id}`, headers: auth() });
|
|
||||||
expect(del.statusCode).toBe(200);
|
|
||||||
const after = (await bundle.app.inject({ method: 'GET', url: '/api/v1/auth/tokens', headers: auth() })).json() as TokensListResponse;
|
|
||||||
expect(after.tokens.find((t) => t.id === victim!.id)).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('404 sur un id inconnu', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'DELETE', url: '/api/v1/auth/tokens/nope-xyz', headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(404);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('409 LAST_TOKEN : refuse de révoquer le dernier token actif', async () => {
|
|
||||||
const list = (await bundle.app.inject({ method: 'GET', url: '/api/v1/auth/tokens', headers: auth() })).json() as TokensListResponse;
|
|
||||||
expect(list.tokens).toHaveLength(1); // seul le token courant subsiste
|
|
||||||
const res = await bundle.app.inject({ method: 'DELETE', url: `/api/v1/auth/tokens/${list.tokens[0]!.id}`, headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(409);
|
|
||||||
expect(res.json()).toMatchObject({ error: { code: 'LAST_TOKEN' } });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('sans authentification → 401', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/auth/tokens' });
|
|
||||||
expect(res.statusCode).toBe(401);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,166 +0,0 @@
|
|||||||
import { afterEach, describe, expect, it } from 'vitest';
|
|
||||||
import { homedir } from 'node:os';
|
|
||||||
import { join } from 'node:path';
|
|
||||||
import {
|
|
||||||
detectPlatform,
|
|
||||||
parseInstallArgs,
|
|
||||||
buildServiceArgs,
|
|
||||||
resolveBin,
|
|
||||||
resolveScriptPath,
|
|
||||||
renderSystemdUnit,
|
|
||||||
renderLaunchAgentPlist,
|
|
||||||
xmlEscape,
|
|
||||||
systemdUnitPath,
|
|
||||||
launchAgentPlistPath,
|
|
||||||
} from '../src/cli/install.js';
|
|
||||||
|
|
||||||
describe('cli install — detectPlatform', () => {
|
|
||||||
it('accepte linux et darwin', () => {
|
|
||||||
expect(detectPlatform('linux')).toBe('linux');
|
|
||||||
expect(detectPlatform('darwin')).toBe('darwin');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('rejette les autres plateformes avec un message clair', () => {
|
|
||||||
expect(() => detectPlatform('win32')).toThrow(/Linux \(systemd\) and macOS \(launchd\)/);
|
|
||||||
expect(() => detectPlatform('freebsd')).toThrow(/freebsd/);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('cli install — buildServiceArgs', () => {
|
|
||||||
it('aucun flag → aucun argument (le service garde les défauts loopback)', () => {
|
|
||||||
expect(buildServiceArgs(parseInstallArgs([]))).toEqual([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('propage --port et --allow-origin (répétable) dans un ordre stable', () => {
|
|
||||||
const flags = parseInstallArgs(['--port', '8080', '--allow-origin', 'a', '--allow-origin', 'b']);
|
|
||||||
expect(buildServiceArgs(flags)).toEqual(['--port', '8080', '--allow-origin', 'a', '--allow-origin', 'b']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("n'injecte JAMAIS --i-know-this-exposes-a-terminal (modèle de sécurité)", () => {
|
|
||||||
const flags = parseInstallArgs(['--bind', '0.0.0.0', '--port', '7317']);
|
|
||||||
expect(buildServiceArgs(flags)).not.toContain('--i-know-this-exposes-a-terminal');
|
|
||||||
});
|
|
||||||
|
|
||||||
it("ne propage pas les flags propres à l'install (bin-path, label, dry-run, no-enable)", () => {
|
|
||||||
const flags = parseInstallArgs(['--bin-path', '/usr/local/bin/arboretum', '--label', 'x', '--dry-run', '--no-enable']);
|
|
||||||
expect(buildServiceArgs(flags)).toEqual([]);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('cli install — resolveBin', () => {
|
|
||||||
it('par défaut : node (process.execPath) + dist/index.js', () => {
|
|
||||||
const { exec, args } = resolveBin({});
|
|
||||||
expect(exec).toBe(process.execPath);
|
|
||||||
expect(args).toHaveLength(1);
|
|
||||||
expect(args[0]).toBe(resolveScriptPath());
|
|
||||||
expect(args[0]).toMatch(/index\.(js|ts)$/);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('--bin-path force le wrapper, sans argument de script', () => {
|
|
||||||
expect(resolveBin({ binPath: '/usr/local/bin/arboretum' })).toEqual({
|
|
||||||
exec: '/usr/local/bin/arboretum',
|
|
||||||
args: [],
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('cli install — renderSystemdUnit', () => {
|
|
||||||
it('contient le ExecStart calculé et les directives clés', () => {
|
|
||||||
const unit = renderSystemdUnit({ exec: '/usr/bin/node', scriptArgs: ['/opt/arboretum/index.js', '--port', '7317'] });
|
|
||||||
expect(unit).toContain('ExecStart=/usr/bin/node /opt/arboretum/index.js --port 7317');
|
|
||||||
expect(unit).toContain('Restart=on-failure');
|
|
||||||
expect(unit).toContain('KillSignal=SIGTERM');
|
|
||||||
expect(unit).toContain('TimeoutStopSec=10');
|
|
||||||
expect(unit).toContain('WantedBy=default.target');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('quote les tokens contenant un espace', () => {
|
|
||||||
const unit = renderSystemdUnit({ exec: '/path with space/node', scriptArgs: ['/s.js'] });
|
|
||||||
expect(unit).toContain('ExecStart="/path with space/node" /s.js');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('snapshot du unit pour un jeu de flags fixe', () => {
|
|
||||||
const unit = renderSystemdUnit({
|
|
||||||
exec: '/usr/bin/node',
|
|
||||||
scriptArgs: ['/opt/arboretum/index.js', '--port', '7317', '--allow-origin', 'https://m.ts.net'],
|
|
||||||
});
|
|
||||||
expect(unit).toMatchInlineSnapshot(`
|
|
||||||
"[Unit]
|
|
||||||
Description=Arboretum — git worktree & Claude Code dashboard
|
|
||||||
After=network-online.target
|
|
||||||
Wants=network-online.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
ExecStart=/usr/bin/node /opt/arboretum/index.js --port 7317 --allow-origin https://m.ts.net
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=5
|
|
||||||
KillSignal=SIGTERM
|
|
||||||
TimeoutStopSec=10
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=default.target
|
|
||||||
"
|
|
||||||
`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('cli install — renderLaunchAgentPlist', () => {
|
|
||||||
const base = {
|
|
||||||
label: 'fr.lidge.arboretum',
|
|
||||||
programArguments: ['/usr/bin/node', '/opt/index.js', '--port', '7317'],
|
|
||||||
stdoutPath: '/Users/me/Library/Logs/arboretum/out.log',
|
|
||||||
stderrPath: '/Users/me/Library/Logs/arboretum/err.log',
|
|
||||||
};
|
|
||||||
|
|
||||||
it('contient le label, les ProgramArguments ordonnés et les clés launchd', () => {
|
|
||||||
const plist = renderLaunchAgentPlist(base);
|
|
||||||
expect(plist).toContain('<string>fr.lidge.arboretum</string>');
|
|
||||||
const idxNode = plist.indexOf('<string>/usr/bin/node</string>');
|
|
||||||
const idxScript = plist.indexOf('<string>/opt/index.js</string>');
|
|
||||||
expect(idxNode).toBeGreaterThan(0);
|
|
||||||
expect(idxScript).toBeGreaterThan(idxNode);
|
|
||||||
expect(plist).toContain('<key>RunAtLoad</key>');
|
|
||||||
expect(plist).toContain('<key>KeepAlive</key>');
|
|
||||||
expect(plist).toContain('<key>StandardOutPath</key>');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('échappe les caractères XML dans les arguments (URL avec &)', () => {
|
|
||||||
const plist = renderLaunchAgentPlist({
|
|
||||||
...base,
|
|
||||||
programArguments: ['/usr/bin/node', '/opt/index.js', '--allow-origin', 'https://a?b&c=d'],
|
|
||||||
});
|
|
||||||
expect(plist).toContain('https://a?b&c=d');
|
|
||||||
expect(plist).not.toContain('b&c=d');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('cli install — xmlEscape', () => {
|
|
||||||
it('échappe &, < et >', () => {
|
|
||||||
expect(xmlEscape('a & b < c > d')).toBe('a & b < c > d');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('cli install — chemins', () => {
|
|
||||||
const savedXdg = process.env.XDG_CONFIG_HOME;
|
|
||||||
afterEach(() => {
|
|
||||||
if (savedXdg === undefined) delete process.env.XDG_CONFIG_HOME;
|
|
||||||
else process.env.XDG_CONFIG_HOME = savedXdg;
|
|
||||||
});
|
|
||||||
|
|
||||||
it('systemdUnitPath respecte XDG_CONFIG_HOME', () => {
|
|
||||||
process.env.XDG_CONFIG_HOME = '/tmp/xdg';
|
|
||||||
expect(systemdUnitPath()).toBe('/tmp/xdg/systemd/user/arboretum.service');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('systemdUnitPath retombe sur ~/.config sans XDG_CONFIG_HOME', () => {
|
|
||||||
delete process.env.XDG_CONFIG_HOME;
|
|
||||||
expect(systemdUnitPath()).toBe(join(homedir(), '.config', 'systemd', 'user', 'arboretum.service'));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('launchAgentPlistPath place le plist dans ~/Library/LaunchAgents', () => {
|
|
||||||
expect(launchAgentPlistPath('fr.lidge.arboretum')).toBe(
|
|
||||||
join(homedir(), 'Library', 'LaunchAgents', 'fr.lidge.arboretum.plist'),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -6,7 +6,7 @@ import type { DialogKind } from '@arboretum/shared';
|
|||||||
import { ScreenReader } from '../src/core/screen-reader.js';
|
import { ScreenReader } from '../src/core/screen-reader.js';
|
||||||
import { classifyDialog, parseOptions, type ClassifiedDialog } from '../src/core/dialog-classifier.js';
|
import { classifyDialog, parseOptions, type ClassifiedDialog } from '../src/core/dialog-classifier.js';
|
||||||
|
|
||||||
const capturesDir = join(dirname(fileURLToPath(import.meta.url)), 'fixtures', 'dialogs');
|
const capturesDir = join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', 'spikes', 's3-tui', 'captures');
|
||||||
|
|
||||||
/** Rejoue un flux PTY brut par segments (comme l'adapter en prod) et collecte écran+dialogue détecté. */
|
/** Rejoue un flux PTY brut par segments (comme l'adapter en prod) et collecte écran+dialogue détecté. */
|
||||||
async function replay(fixture: string): Promise<Array<{ dialog: ClassifiedDialog; text: string }>> {
|
async function replay(fixture: string): Promise<Array<{ dialog: ClassifiedDialog; text: string }>> {
|
||||||
@@ -26,7 +26,7 @@ async function replay(fixture: string): Promise<Array<{ dialog: ClassifiedDialog
|
|||||||
|
|
||||||
describe('ScreenReader (@xterm/headless) — anti strip-ANSI naïf', () => {
|
describe('ScreenReader (@xterm/headless) — anti strip-ANSI naïf', () => {
|
||||||
it('préserve les espaces du dialogue (« Do you want to create », pas « Doyouwant »)', async () => {
|
it('préserve les espaces du dialogue (« Do you want to create », pas « Doyouwant »)', async () => {
|
||||||
const seen = await replay('perm-write2.raw');
|
const seen = await replay('perm-write2.raw.log');
|
||||||
expect(seen.length).toBeGreaterThan(0);
|
expect(seen.length).toBeGreaterThan(0);
|
||||||
expect(seen.some((s) => /Do you want to create/.test(s.text))).toBe(true);
|
expect(seen.some((s) => /Do you want to create/.test(s.text))).toBe(true);
|
||||||
});
|
});
|
||||||
@@ -57,7 +57,7 @@ describe('classifyDialog — unitaire (lignes synthétiques)', () => {
|
|||||||
|
|
||||||
describe('détection sur fixtures réelles S3 (replay headless)', () => {
|
describe('détection sur fixtures réelles S3 (replay headless)', () => {
|
||||||
it('perm-write2 → permission avec options Yes/…/No, option 1 sélectionnée', async () => {
|
it('perm-write2 → permission avec options Yes/…/No, option 1 sélectionnée', async () => {
|
||||||
const perms = (await replay('perm-write2.raw')).filter((s) => s.dialog.kind === 'permission');
|
const perms = (await replay('perm-write2.raw.log')).filter((s) => s.dialog.kind === 'permission');
|
||||||
expect(perms.length).toBeGreaterThan(0);
|
expect(perms.length).toBeGreaterThan(0);
|
||||||
const withOpts = perms.find((s) => s.dialog.options.length >= 2);
|
const withOpts = perms.find((s) => s.dialog.options.length >= 2);
|
||||||
expect(withOpts).toBeDefined();
|
expect(withOpts).toBeDefined();
|
||||||
@@ -68,13 +68,13 @@ describe('détection sur fixtures réelles S3 (replay headless)', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('ask2 → question avec une option « Rouge »', async () => {
|
it('ask2 → question avec une option « Rouge »', async () => {
|
||||||
const qs = (await replay('ask2.raw')).filter((s) => s.dialog.kind === 'question');
|
const qs = (await replay('ask2.raw.log')).filter((s) => s.dialog.kind === 'question');
|
||||||
expect(qs.length).toBeGreaterThan(0);
|
expect(qs.length).toBeGreaterThan(0);
|
||||||
expect(qs.some((s) => s.dialog.options.some((o) => /Rouge/.test(o.label)))).toBe(true);
|
expect(qs.some((s) => s.dialog.options.some((o) => /Rouge/.test(o.label)))).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('trust → dialogue trust détecté', async () => {
|
it('trust → dialogue trust détecté', async () => {
|
||||||
const seen = await replay('trust.raw');
|
const seen = await replay('trust.raw.log');
|
||||||
expect(seen.some((s) => s.dialog.kind === 'trust')).toBe(true);
|
expect(seen.some((s) => s.dialog.kind === 'trust')).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -83,10 +83,10 @@ describe('détection sur fixtures réelles S3 (replay headless)', () => {
|
|||||||
// classifié de façon fiable (cf. « reste à faire P4 » du verdict S3 : couvrir le refus Esc et le plan).
|
// classifié de façon fiable (cf. « reste à faire P4 » du verdict S3 : couvrir le refus Esc et le plan).
|
||||||
describe('campagne de fiabilité P4-C — tous les types de dialogue', () => {
|
describe('campagne de fiabilité P4-C — tous les types de dialogue', () => {
|
||||||
const realCaptures: Array<{ fixture: string; kind: DialogKind }> = [
|
const realCaptures: Array<{ fixture: string; kind: DialogKind }> = [
|
||||||
{ fixture: 'trust.raw', kind: 'trust' },
|
{ fixture: 'trust.raw.log', kind: 'trust' },
|
||||||
{ fixture: 'perm-write2.raw', kind: 'permission' },
|
{ fixture: 'perm-write2.raw.log', kind: 'permission' },
|
||||||
{ fixture: 'perm-bash2.raw', kind: 'permission' },
|
{ fixture: 'perm-bash2.raw.log', kind: 'permission' },
|
||||||
{ fixture: 'ask2.raw', kind: 'question' },
|
{ fixture: 'ask2.raw.log', kind: 'question' },
|
||||||
];
|
];
|
||||||
for (const c of realCaptures) {
|
for (const c of realCaptures) {
|
||||||
it(`${c.fixture} → ${c.kind} détecté (capture réelle)`, async () => {
|
it(`${c.fixture} → ${c.kind} détecté (capture réelle)`, async () => {
|
||||||
@@ -97,7 +97,7 @@ describe('campagne de fiabilité P4-C — tous les types de dialogue', () => {
|
|||||||
|
|
||||||
it('refus par Esc (deny-esc2) : un dialogue est bien affiché avant l’annulation', async () => {
|
it('refus par Esc (deny-esc2) : un dialogue est bien affiché avant l’annulation', async () => {
|
||||||
// un dialogue détecté = l'utilisateur peut répondre « deny » (Esc) depuis le mobile sans terminal.
|
// un dialogue détecté = l'utilisateur peut répondre « deny » (Esc) depuis le mobile sans terminal.
|
||||||
const seen = await replay('deny-esc2.raw');
|
const seen = await replay('deny-esc2.raw.log');
|
||||||
expect(seen.length).toBeGreaterThan(0);
|
expect(seen.length).toBeGreaterThan(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,572 +0,0 @@
|
|||||||
7[r8[?25h[?25l[?2004h[?1004h[?2031h[?2026h
|
|
||||||
[38;2;255;204;0m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[2G[38;2;255;204;0m[1mAccessing[12Gworkspace:[22m[39m
|
|
||||||
|
|
||||||
[2G[1m/tmp/spike-s3-ask2[22m
|
|
||||||
|
|
||||||
[2GQuick[8Gsafety[15Gcheck:[22GIs[25Gthis[30Ga[32Gproject[40Gyou[44Gcreated[52Gor[55Gone[59Gyou[63Gtrust?[70G(Like[76Gyour[81Gown[85Gcode,[91Ga[93Gwell-known[104Gopen[109Gsource
|
|
||||||
[2Gproject,[11Gor[14Gwork[19Gfrom[24Gyour[29Gteam).[36GIf[39Gnot,[44Gtake[49Ga[51Gmoment[58Gto[61Greview[68Gwhat's[75Gin[78Gthis[83Gfolder[90Gfirst.
|
|
||||||
|
|
||||||
[2GClaude[9GCode'll[17Gbe[20Gable[25Gto[28Gread,[34Gedit,[40Gand[44Gexecute[52Gfiles[58Ghere.
|
|
||||||
|
|
||||||
[2G]8;id=zaxmda;https://code.claude.com/docs/en/security[38;2;153;153;153mSecurity guide[39m]8;;
|
|
||||||
|
|
||||||
[2G[38;2;153;204;255m❯[4G[38;2;153;153;153m1.[7G[38;2;153;204;255mYes,[12GI[14Gtrust[20Gthis[25Gfolder[39m
|
|
||||||
[4G[38;2;153;153;153m2.[7G[39mNo,[11Gexit
|
|
||||||
|
|
||||||
[2G[38;2;153;153;153mEnter[8Gto[11Gconfirm[19G·[21GEsc[25Gto[28Gcancel[39m
|
|
||||||
[1C[4A[?2026l[>0q[c[?2026h[1D[4B
[6C[4A[38;2;51;153;255mYes, I trust this folder[32G✔[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[1C[4A[?2026l]0;✳ Claude Code[?2026h[1D[4B[2K[G[1A
[16A[38;2;255;153;51m╭───[6GClaude Code[18G[38;2;153;153;153mv2.1.173[27G[38;2;255;153;51m─────────────────────────────────────────────────────────────────────────────────────────────╮
[1B│[39m [2m[38;2;255;153;51m│[39m[22m [38;2;255;153;51m[1mTips for getting started[22m[39m [38;2;255;153;51m│
[1B│[39m [1mWelcome back Johan![54G[22m[2m[38;2;255;153;51m│[56G[39m[22mRun[60G/init[66Gto[69Gcreate[76Ga[78GCLAUDE.md[88Gfile[93Gwith[98Ginstructions[111Gfor[115GCla…[120G[38;2;255;153;51m│
[1B│[54G[2m│[56G[22m───────────────────────────────────────────────────────────────[120G│
[1B│[39m [24G[38;2;215;119;87m ▐[48;2;0;0;0m▛███▜[49m▌[54G[2m[38;2;255;153;51m│[56G[22m[1mWhat's new[120G[22m│
[1B│[24G[38;2;215;119;87m▝▜[48;2;0;0;0m█████[49m▛▘[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62GFable[68G5[70Gmodel[76Gnames[82Gwith[87Ga[89G`[1m]`[96Gsuffix[103Gnot[107Gbeing[113Gnorma…[120G[38;2;255;153;51m│
[1B│[39m [8G [15G [22G [38;2;215;119;87m ▘▘ ▝▝ [39m [40G [44G [52G [2m[38;2;255;153;51m│[39m[22m Fixed a spurious "sandbox depen[89Gncies missing"[104Gstartup warnin…[120G[38;2;255;153;51m│
[1B│[39m [38;2;153;153;153mOpus 4.8 (1M context) with xh… · Claude Team · [39m [2m[38;2;255;153;51m│[39m[22m Sub-ag[63Gnts can now[75Gspawn their own sub-agents[102G(up[106Gto[109G5[111Glevels[118G…[120G[38;2;255;153;51m│
[1B│[5G[38;2;153;153;153mBeehelp[54G[2m[38;2;255;153;51m│[56G[22m[38;2;153;153;153m[3m/release-notes for more[120G[23m[38;2;255;153;51m│
[1B│[39m [9G [17G [38;2;153;153;153m/tmp/spike-s3-ask2[39m [40G [44G [52G [2m[38;2;255;153;51m│[39m[22m [58G [120G[38;2;255;153;51m│
[1B╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
[1C[1B[39m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1B[39m❯ [2mTry "fix lint errors"[22m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[2C[1B[38;2;153;153;153m? for shortcuts · ← for agents[102G◉ xhigh · /effort
[1B[39m[K[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[3A[K
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4A [38;2;255;204;0m⚠ 2 setup issues: MCP[38;2;153;153;153m · /doctor[39m[K
[1B[K
[1B [38;2;255;153;51m▎[39m Meet [38;2;255;153;51m[1mFable 5[22m[39m, our newest model for complex, long-running work. Try anytime with /model.[K
[1C[1B[38;2;255;153;51m▎[39m [38;2;153;153;153mIncluded in your[21Gplan limits until Jun 22, then switch to usage credits to continue.[102G[39m[K
|
|
||||||
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
❯
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153m?[5Gfor[9Gshortcuts[19G·[21G←[23Gfor[27Gagents[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[3AUse[7Gthe[11GAskUserQuestion[27Gtool[32Gto[35Gask[39Gme[42Gwhether[50GI[52Gprefer[59Gred[63Gor[66Gblue.[72GOffer[78Gexactly[86Gthose[92Gtwo[96Goptions.
[2C[2B
|
|
||||||
[103C[3A[?25h[?2026l]0;⠂ Claude Code[?2026h[?25l[103D[3B
[4A[48;2;55;55;55m[38;2;80;80;80m❯ [38;2;255;255;255mUse the AskUserQuestion tool to ask me whether I prefer red or blue. Offer exactly those two options.[39m
[1B[49m[K
[1B[38;2;255;153;51m✽[39m [38;2;255;153;51mSimmering… [39m[K
[101C[1B[K
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;183;101m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;153;51m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Claude Code]0;⠐ Demander la couleur préférée red ou blue[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mS[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;183;101mi[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;153;51mS[5G[38;2;255;183;101mmm[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;153;51mi[7G[38;2;255;183;101me[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[5Gm[8G[38;2;255;183;101mr[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[5C[6A[38;2;255;153;51mme[9G[38;2;255;183;101min[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[7C[6A[38;2;255;153;51mr[11G[38;2;255;183;101mg[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[9Gi[12G[38;2;255;183;101m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[9C[6A[38;2;255;153;51mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[11Gg…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Demander la couleur préférée red ou blue[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mS[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[4G[38;2;255;183;101mi[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;183;101mm[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[3GS[6G[38;2;255;183;101mm[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;153;51mim[7G[38;2;255;183;101mer[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[5C[6A[38;2;255;153;51mm[9G[38;2;255;183;101mi[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Demander la couleur préférée red ou blue[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[7Ge[10G[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mSim[8G[38;2;255;153;51mrin[14G[38;2;153;153;153m(2s · [38;2;177;177;177mthinking with xhigh effort[38;2;153;153;153m)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[19C[6A[38;2;173;173;173mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;153;51mm[15G[38;2;153;153;153m3[20G[38;2;169;169;169mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[19C[6A[38;2;161;161;161mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[4Gi[20G[38;2;153;153;153m↓[39m [38;2;153;153;153m38 tokens · [38;2;157;157;157mthinking with xhigh effort[38;2;153;153;153m)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[21C[6A[38;2;153;153;153m57[34Gthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[3GS[22G[38;2;153;153;153m6[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[22G[38;2;153;153;153m74[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[22G[38;2;153;153;153m91[34G[38;2;157;157;157mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Demander la couleur préférée red ou blue[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[23G[38;2;153;153;153m9[34G[38;2;161;161;161mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[21C[6A[38;2;153;153;153m102 tokens · [38;2;165;165;165mthinking with xhigh effort[38;2;153;153;153m)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[14C[6A[38;2;153;153;153m4[24G4[35G[38;2;173;173;173mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[23C[6A[38;2;153;153;153m6[35G[38;2;177;177;177mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[23G[38;2;153;153;153m19[35G[38;2;181;181;181mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[23G[38;2;153;153;153m2[35G[38;2;185;185;185mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[22C[6A[38;2;153;153;153m36[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[23G[38;2;153;153;153m41[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;✳ Demander la couleur préférée red ou blue[?2026h[?25l[2D[3B
[7A[38;2;153;153;153m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1B[48;2;153;204;255m[38;2;0;0;0m ☐ Couleur [39m[49m[K
[2B[38;2;255;255;255m[1mPréférez-vous le rouge ou le bleu ?[22m[39m[K
[1B[K
[1B[38;2;153;204;255m❯[39m [38;2;153;153;153m1.[39m [38;2;153;204;255mRouge[39m[K
[2C[1B [38;2;153;153;153mVous préférez le rouge.[102G[39m[K
|
|
||||||
[3G[38;2;153;153;153m2.[6G[39mBleu
|
|
||||||
[6G[38;2;153;153;153mVous[11Gpréférez[20Gle[23Gbleu.[39m
|
|
||||||
[3G[38;2;153;153;153m3.[6GType[11Gsomething.[39m
|
|
||||||
[38;2;153;153;153m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G4.[6GChat[11Gabout[17Gthis
|
|
||||||
|
|
||||||
[38;2;153;153;153mEnter[7Gto[10Gselect[17G·[19G↑/↓[23Gto[26Gnavigate[35G·[37GEsc[41Gto[44Gcancel[39m
|
|
||||||
[9A[?2026l(B[?2026h[9B
[9A [6GRouge
[2B[38;2;153;204;255m❯[6GBleu[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[7A[?2026l]0;⠂ Demander la couleur préférée red ou blue[?2026h[7B[H[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[H[38;2;255;153;51m╭───[6GClaude[13GCode[18G[38;2;153;153;153mv2.1.173[27G[38;2;255;153;51m─────────────────────────────────────────────────────────────────────────────────────────────╮[39m
|
|
||||||
[38;2;255;153;51m│[54G[2m│[56G[22m[1mTips[61Gfor[65Ggetting[73Gstarted[120G[22m│[39m
|
|
||||||
[38;2;255;153;51m│[19G[39m[1mWelcome[27Gback[32GJohan![54G[22m[2m[38;2;255;153;51m│[56G[39m[22mRun[60G/init[66Gto[69Gcreate[76Ga[78GCLAUDE.md[88Gfile[93Gwith[98Ginstructions[111Gfor[115GCla…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[54G[2m│[56G[22m───────────────────────────────────────────────────────────────[120G│[39m
|
|
||||||
[38;2;255;153;51m│[24G[38;2;215;119;87m ▐[48;2;0;0;0m▛███▜[49m▌[54G[2m[38;2;255;153;51m│[56G[22m[1mWhat's[63Gnew[120G[22m│[39m
|
|
||||||
[38;2;255;153;51m│[24G[38;2;215;119;87m▝▜[48;2;0;0;0m█████[49m▛▘[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62GFable[68G5[70Gmodel[76Gnames[82Gwith[87Ga[89G`[1m]`[96Gsuffix[103Gnot[107Gbeing[113Gnorma…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[24G[38;2;215;119;87m [26G▘▘[29G▝▝[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62Ga[64Gspurious[73G"sandbox[82Gdependencies[95Gmissing"[104Gstartup[112Gwarnin…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[5G[38;2;153;153;153mOpus[10G4.8[14G(1M[18Gcontext)[27Gwith[32Gxh…[36G·[38GClaude[45GTeam[50G·[54G[2m[38;2;255;153;51m│[56G[39m[22mSub-agents[67Gcan[71Gnow[75Gspawn[81Gtheir[87Gown[91Gsub-agents[102G(up[106Gto[109G5[111Glevels[118G…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[5G[38;2;153;153;153mBeehelp[54G[2m[38;2;255;153;51m│[56G[22m[38;2;153;153;153m[3m/release-notes[71Gfor[75Gmore[120G[23m[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[19G[38;2;153;153;153m/tmp/spike-s3-ask2[54G[2m[38;2;255;153;51m│[120G[22m│[39m
|
|
||||||
[38;2;255;153;51m╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[39m
|
|
||||||
|
|
||||||
[2G[38;2;255;204;0m⚠[4G2[6Gsetup[12Gissues:[20GMCP[38;2;153;153;153m ·[26G/doctor[39m
|
|
||||||
|
|
||||||
[2G[38;2;255;153;51m▎[4G[39mMeet[9G[38;2;255;153;51m[1mFable[15G5[22m[39m,[18Gour[22Gnewest[29Gmodel[35Gfor[39Gcomplex,[48Glong-running[61Gwork.[67GTry[71Ganytime[79Gwith[84G/model.
|
|
||||||
[2G[38;2;255;153;51m▎[4G[38;2;153;153;153mIncluded[13Gin[16Gyour[21Gplan[26Glimits[33Guntil[39GJun[43G22,[47Gthen[52Gswitch[59Gto[62Gusage[68Gcredits[76Gto[79Gcontinue.[39m
|
|
||||||
|
|
||||||
[48;2;55;55;55m[38;2;80;80;80m❯ [38;2;255;255;255mUse the AskUserQuestion tool to ask me whether I prefer red or blue. Offer exactly those two options.[39m [49m
|
|
||||||
|
|
||||||
[38;2;255;153;51m✻[3G[38;2;255;157;57mBunning…[38;2;255;153;51m [38;2;153;153;153m(4s[16G·[18G↓[20G215[24Gtokens)[39m
|
|
||||||
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[21G[38;2;255;204;0mYou've[28Gused[33G96%[37Gof[40Gyour[45Gsession[53Glimit[59G·[61Gresets[68G7pm[72G(Europe/Paris)[87G·[89G/usage-credits[104Gto[107Grequest[115Gmore[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[3GBunning…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;255;255m● [39mUser answered Claude's questions:
[1B[38;2;153;153;153m ⎿ · Préférez-vous le rouge ou le bleu ? → Bleu
[1B[39m[K
[1B[38;2;255;153;51m✢[39m [38;2;255;153;51mBu[38;2;255;183;101mnni[38;2;255;153;51mng… [38;2;153;153;153m(4s · ↑[20G215 tokens)
[1B[39m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[21G[38;2;255;204;0mYou've[28Gused[33G96%[37Gof[40Gyour[45Gsession[53Glimit[59G·[61Gresets[68G7pm[72G(Europe/Paris)[87G·[89G/usage-credits[104Gto[107Grequest[115Gmore[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;153;51mn[8G[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[6Gni[9G[38;2;255;183;101mg…[13G[38;2;153;153;153m5[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[7C[6A[38;2;255;153;51mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[8C[6A[38;2;255;153;51mg[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[9C[6A[38;2;255;153;51m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Demander la couleur préférée red ou blue[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[12C[6A[38;2;153;153;153m6[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mB[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;183;101mun[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;153;51mB[6G[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;153;51mu[7G[38;2;255;183;101mi[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;153;51mnn[8G[38;2;255;183;101mng[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[7Gi[10G[38;2;255;183;101m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[7C[6A[38;2;255;153;51mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Demander la couleur préférée red ou blue[?2026h[?25l[2D[3B
[8C[6A[38;2;255;153;51mg[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[10G…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[12C[6A[38;2;153;153;153m7[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Demander la couleur préférée red ou blue[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mBu[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[3GB[6G[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;153;51mu[7G[38;2;255;183;101mi[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[5Gnn[8G[38;2;255;183;101mng[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6C[6A[38;2;255;153;51mi[10G[38;2;255;183;101m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[8Gn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[8C[6A[38;2;255;153;51mg…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[13G[38;2;153;153;153m8[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;255;255m●[3G[39mVous avez choisi[20Gle [1mbleu[22m 🔵[K
[2B[38;2;255;153;51m✽[39m [38;2;255;164;70mBunning…[38;2;255;153;51m [38;2;153;153;153m(running stop hook · 8s · ↓[39m [38;2;153;153;153m218 tokens)[39m[K
[1B[K
[2B[38;2;153;153;153m❯ [39m[K
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[21G[38;2;255;204;0mYou've[28Gused[33G96%[37Gof[40Gyour[45Gsession[53Glimit[59G·[61Gresets[68G7pm[72G(Europe/Paris)[87G·[89G/usage-credits[104Gto[107Grequest[115Gmore[39m
|
|
||||||
[2C[3A[?25h[?2026l]0;✳ Demander la couleur préférée red ou blue[?2026h[?25l[2D[3B
[6A[38;2;153;153;153m✻[3GSautéed fo[14G 8s[39m[K
[3B❯
[2C[2B[38;2;153;153;153m? for shortcuts · ← for agents[39m[K
|
|
||||||
[21G[38;2;255;204;0mYou've[28Gused[33G96%[37Gof[40Gyour[45Gsession[53Glimit[59G·[61Gresets[68G7pm[72G(Europe/Paris)[87G·[89G/usage-credits[104Gto[107Grequest[115Gmore[39m
|
|
||||||
[2C[4A[?25h[?2026l
|
|
||||||
@@ -1,482 +0,0 @@
|
|||||||
7[r8[?25h[?25l[?2004h[?1004h[?2031h[?2026h
|
|
||||||
[38;2;255;204;0m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[2G[38;2;255;204;0m[1mAccessing[12Gworkspace:[22m[39m
|
|
||||||
|
|
||||||
[2G[1m/tmp/spike-s3-deny2[22m
|
|
||||||
|
|
||||||
[2GQuick[8Gsafety[15Gcheck:[22GIs[25Gthis[30Ga[32Gproject[40Gyou[44Gcreated[52Gor[55Gone[59Gyou[63Gtrust?[70G(Like[76Gyour[81Gown[85Gcode,[91Ga[93Gwell-known[104Gopen[109Gsource
|
|
||||||
[2Gproject,[11Gor[14Gwork[19Gfrom[24Gyour[29Gteam).[36GIf[39Gnot,[44Gtake[49Ga[51Gmoment[58Gto[61Greview[68Gwhat's[75Gin[78Gthis[83Gfolder[90Gfirst.
|
|
||||||
|
|
||||||
[2GClaude[9GCode'll[17Gbe[20Gable[25Gto[28Gread,[34Gedit,[40Gand[44Gexecute[52Gfiles[58Ghere.
|
|
||||||
|
|
||||||
[2G]8;id=zaxmda;https://code.claude.com/docs/en/security[38;2;153;153;153mSecurity guide[39m]8;;
|
|
||||||
|
|
||||||
[2G[38;2;153;204;255m❯[4G[38;2;153;153;153m1.[7G[38;2;153;204;255mYes,[12GI[14Gtrust[20Gthis[25Gfolder[39m
|
|
||||||
[4G[38;2;153;153;153m2.[7G[39mNo,[11Gexit
|
|
||||||
|
|
||||||
[2G[38;2;153;153;153mEnter[8Gto[11Gconfirm[19G·[21GEsc[25Gto[28Gcancel[39m
|
|
||||||
[1C[4A[?2026l[>0q[c[?2026h[1D[4B
[6C[4A[38;2;51;153;255mYes, I trust this folder[32G✔[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[1C[4A[?2026l]0;✳ Claude Code[?2026h[1D[4B[2K[G[1A
[16A[38;2;255;153;51m╭───[6GClaude Code[18G[38;2;153;153;153mv2.1.173[27G[38;2;255;153;51m─────────────────────────────────────────────────────────────────────────────────────────────╮
[1B│[39m [2m[38;2;255;153;51m│[39m[22m [38;2;255;153;51m[1mTips for getting started[22m[39m [38;2;255;153;51m│
[1B│[39m [1mWelcome back Johan![54G[22m[2m[38;2;255;153;51m│[56G[39m[22mRun[60G/init[66Gto[69Gcreate[76Ga[78GCLAUDE.md[88Gfile[93Gwith[98Ginstructions[111Gfor[115GCla…[120G[38;2;255;153;51m│
[1B│[54G[2m│[56G[22m───────────────────────────────────────────────────────────────[120G│
[1B│[39m [24G[38;2;215;119;87m ▐[48;2;0;0;0m▛███▜[49m▌[54G[2m[38;2;255;153;51m│[56G[22m[1mWhat's new[120G[22m│
[1B│[24G[38;2;215;119;87m▝▜[48;2;0;0;0m█████[49m▛▘[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62GFable[68G5[70Gmodel[76Gnames[82Gwith[87Ga[89G`[1m]`[96Gsuffix[103Gnot[107Gbeing[113Gnorma…[120G[38;2;255;153;51m│
[1B│[39m [8G [15G [22G [38;2;215;119;87m ▘▘ ▝▝ [39m [40G [44G [52G [2m[38;2;255;153;51m│[39m[22m Fixed a spurious "sandbox depen[89Gncies missing"[104Gstartup warnin…[120G[38;2;255;153;51m│
[1B│[39m [38;2;153;153;153mOpus 4.8 (1M context) with xh… · Claude Team · [39m [2m[38;2;255;153;51m│[39m[22m Sub-ag[63Gnts can now[75Gspawn their own sub-agents[102G(up[106Gto[109G5[111Glevels[118G…[120G[38;2;255;153;51m│
[1B│[5G[38;2;153;153;153mBeehelp[54G[2m[38;2;255;153;51m│[56G[22m[38;2;153;153;153m[3m/release-notes for more[120G[23m[38;2;255;153;51m│
[1B│[39m [9G [17G [38;2;153;153;153m/tmp/spike-s3-deny2[39m [40G [44G [52G [2m[38;2;255;153;51m│[39m[22m [58G [120G[38;2;255;153;51m│
[1B╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
[1C[1B[39m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1B[39m❯ [2mTry "create a util logging.py that..."
[1B[22m[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[2C[1B[38;2;153;153;153m? for shortcuts · ← for agents[102G◉ xhigh · /effort
[1B[39m[K[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[3A[K
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4A [38;2;255;204;0m⚠ 2 setup issues: MCP[38;2;153;153;153m · /doctor[39m[K
[1B[K
[1B [38;2;255;153;51m▎[39m Meet [38;2;255;153;51m[1mFable 5[22m[39m, our newest model for complex, long-running work. Try anytime with /model.[K
[1C[1B[38;2;255;153;51m▎[39m [38;2;153;153;153mIncluded in your[21Gplan limits until Jun 22, then switch to usage credits to continue.[102G[39m[K
|
|
||||||
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
❯
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153m?[5Gfor[9Gshortcuts[19G·[21G←[23Gfor[27Gagents[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[3ARun[7Gthis[12Gexact[18Gbash[23Gcommand[31Gand[35Gshow[40Gme[43Gits[47Goutput:[55Gnode[60G-e[63G"console.log('should-be-denied')"[97G—[99Gdo[102Gnot[106Gdo[109Ganything
[1B else.[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[102G[38;2;153;153;153m◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[7C[3A[?25h[?2026l]0;⠂ Claude Code[?2026h[?25l[7D[3B
[5A[48;2;55;55;55m[38;2;80;80;80m❯ [38;2;255;255;255mRun this exact bash command and show me its output: node -e "console.log('should-be-denied')" — do not do anything [39m
[1B [38;2;255;255;255melse.[39m
[2C[1B[49m[K
[1B[38;2;255;153;51m✽[39m [38;2;255;153;51mUnfurling… [39m[K
[101C[1B[K
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;183;101m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;153;51m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Claude Code[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mU[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Execute Node.js command in bash[?2026h[?25l[2D[3B
[3C[6A[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;153;51mU[5G[38;2;255;183;101mfu[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;153;51mn[7G[38;2;255;183;101mr[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[5Gf[8G[38;2;255;183;101ml[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[5C[6A[38;2;255;153;51mur[9G[38;2;255;183;101min[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[7C[6A[38;2;255;153;51ml[11G[38;2;255;183;101mg[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[9Gi[12G[38;2;255;183;101m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[9C[6A[38;2;255;153;51mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[11Gg…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Execute Node.js command in bash[?2026h[?25l[2D[3B
[6C[6A[38;2;255;183;101mrli[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[13C[6A[38;2;153;153;153m(2s · [38;2;169;169;169mthinking with xhigh effort[38;2;153;153;153m)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[19C[6A[38;2;177;177;177mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[6G[38;2;255;183;101mu[9G[38;2;255;153;51mi[20G[38;2;181;181;181mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[19C[6A[38;2;185;185;185mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[5G[38;2;255;183;101mf[8G[38;2;255;153;51ml[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[4G[38;2;255;183;101mn[7G[38;2;255;153;51mr[20G[38;2;181;181;181mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Execute Node.js command in bash[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[3G[38;2;255;183;101mU[6G[38;2;255;153;51mu[20G[38;2;177;177;177mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[19C[6A[38;2;173;173;173mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[14C[6A[38;2;153;153;153m3[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;153;51mf[20G[38;2;153;153;153m↓[39m [38;2;153;153;153m25 tokens · [38;2;169;169;169mthinking with xhigh effort[38;2;153;153;153m)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[21C[6A[38;2;153;153;153m50[34G[38;2;161;161;161mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[4Gn[22G[38;2;153;153;153m76[34G[38;2;157;157;157mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[21C[6A[38;2;153;153;153m8[34Gthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[3GU[22G[38;2;153;153;153m93[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[22G[38;2;153;153;153m104 tokens · thinking with xhigh e[57Gfort)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[23G[38;2;153;153;153m16[35G[38;2;157;157;157mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;153;153;153m●[3G[39m[1mBash[22m(node -e "console.log('should-be-denied')")[K
[1B[38;2;153;153;153m ⎿ Waiting…
[1B[39m[K
[1B[38;2;255;153;51m✻[39m [38;2;255;153;51mUnfurling… [38;2;153;153;153m(3s · ↓[22G116 tokens · [38;2;157;157;157mthinking with xhigh effort[38;2;153;153;153m)
[1B[39m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Execute Node.js command in bash[?2026h[?25l[2D[3B
[9A[38;2;153;153;153m
[5C[1BRunn
[31C[2B)[39m[K
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;179;95mUnfurling…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[3G[38;2;255;176;89mUnfurling…[23G[38;2;153;153;153m35[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[9A[38;2;153;153;153m●[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[9A[38;2;51;153;255m●
[5C[1B[39mshould-be-denied
[2C[2B[38;2;255;153;51mUnfurling…[20G[38;2;153;153;153m↑[23G41[32G · [38;2;161;161;161mthinking with xhigh effort[38;2;153;153;153m)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[23C[6A[38;2;153;153;153m6[35G[38;2;165;165;165mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mU[23G[38;2;153;153;153m50[35G[38;2;169;169;169mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[14C[6A[38;2;153;153;153m4[35Gthought for 1s)[39m[K
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;183;101mnf[24G[38;2;153;153;153m7[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;153;51mU[6G[38;2;255;183;101mu[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;153;51mn[7G[38;2;255;183;101mr[24G[38;2;153;153;153m8[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[5Gf[8G[38;2;255;183;101ml[23G[38;2;153;153;153m60[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[5C[6A[38;2;255;153;51mur[9G[38;2;255;183;101min[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[8Gl[11G[38;2;255;183;101mg[24G[38;2;153;153;153m1[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[8C[6A[38;2;255;153;51mi[12G[38;2;255;183;101m…[24G[38;2;153;153;153m2[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[10Gng[24G[38;2;153;153;153m3[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;153;51m…[24G[38;2;153;153;153m4[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[24G[38;2;153;153;153m5[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[23C[6A[38;2;153;153;153m6[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Execute Node.js command in bash[?2026h[?25l[2D[3B
[23C[6A[38;2;153;153;153m7[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[24G[38;2;153;153;153m8[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[23C[6A[38;2;153;153;153m9[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[22C[6A[38;2;153;153;153m70[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[23C[6A[38;2;153;153;153m1[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[14C[6A[38;2;153;153;153m5[24G2[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[24G[38;2;153;153;153m3[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mU[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[4G[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;183;101mf[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[3GUn[6G[38;2;255;183;101mur[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;153;51mfur[20G[38;2;153;153;153m↓[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Execute Node.js command in bash[?2026h[?25l[2D[3B
[6A[38;2;255;255;255m●[3G[39mVoici la sortie de[22Gla commande :[K
[2B should-be-denied[K
[1B[K
[1B[38;2;255;153;51m✻[39m [38;2;255;153;51mUnfurling… [38;2;153;153;153m(5s · ↓[39m [38;2;153;153;153m173 tokens · thought for 1s)[39m[K
[2C[1B[K
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[23C[6A[38;2;153;153;153m4[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;179;95mUnfurling…[15G[38;2;153;153;153mrunning stop hook[35G5s · ↓[39m [38;2;153;153;153m174 tokens · thought for 1s)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;✳ Execute Node.js command in bash[?2026h[?25l[2D[3B
[6A[38;2;153;153;153m✻[3GChurned for 5s[39m[K
[3B❯
[2C[2B[38;2;153;153;153m? for shortcuts · ← for agents[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[101C[1A[K
|
|
||||||
[21G[38;2;255;204;0mYou've[28Gused[33G94%[37Gof[40Gyour[45Gsession[53Glimit[59G·[61Gresets[68G7pm[72G(Europe/Paris)[87G·[89G/usage-credits[104Gto[107Grequest[115Gmore[39m
|
|
||||||
[2C[4A[?25h[?2026l[?2026h[?25l[2D[4B[2K[G[1A[K[2C[3A[?25h[?2026l[?1006l[?1003l[?1002l[?1000l[2D[3B(B[>4m[<u[?1004l[?2031l[?2004l[?25h7[r8]0;[2m[22m
|
|
||||||
[2mResume this session with:[22m
|
|
||||||
[2mclaude --resume 68c4db8a-2120-4ab9-9c03-cd3313675be5[22m
|
|
||||||
[2m[22m
|
|
||||||
@@ -1,442 +0,0 @@
|
|||||||
7[r8[?25h[?25l[?2004h[?1004h[?2031h[?2026h
|
|
||||||
[38;2;255;204;0m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[2G[38;2;255;204;0m[1mAccessing[12Gworkspace:[22m[39m
|
|
||||||
|
|
||||||
[2G[1m/tmp/spike-s3-bash2[22m
|
|
||||||
|
|
||||||
[2GQuick[8Gsafety[15Gcheck:[22GIs[25Gthis[30Ga[32Gproject[40Gyou[44Gcreated[52Gor[55Gone[59Gyou[63Gtrust?[70G(Like[76Gyour[81Gown[85Gcode,[91Ga[93Gwell-known[104Gopen[109Gsource
|
|
||||||
[2Gproject,[11Gor[14Gwork[19Gfrom[24Gyour[29Gteam).[36GIf[39Gnot,[44Gtake[49Ga[51Gmoment[58Gto[61Greview[68Gwhat's[75Gin[78Gthis[83Gfolder[90Gfirst.
|
|
||||||
|
|
||||||
[2GClaude[9GCode'll[17Gbe[20Gable[25Gto[28Gread,[34Gedit,[40Gand[44Gexecute[52Gfiles[58Ghere.
|
|
||||||
|
|
||||||
[2G]8;id=zaxmda;https://code.claude.com/docs/en/security[38;2;153;153;153mSecurity guide[39m]8;;
|
|
||||||
|
|
||||||
[2G[38;2;153;204;255m❯[4G[38;2;153;153;153m1.[7G[38;2;153;204;255mYes,[12GI[14Gtrust[20Gthis[25Gfolder[39m
|
|
||||||
[4G[38;2;153;153;153m2.[7G[39mNo,[11Gexit
|
|
||||||
|
|
||||||
[2G[38;2;153;153;153mEnter[8Gto[11Gconfirm[19G·[21GEsc[25Gto[28Gcancel[39m
|
|
||||||
[1C[4A[?2026l[>0q[c[?2026h[1D[4B
[6C[4A[38;2;51;153;255mYes, I trust this folder[32G✔[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[1C[4A[?2026l]0;✳ Claude Code[?2026h[1D[4B[2K[G[1A
[16A[38;2;255;153;51m╭───[6GClaude Code[18G[38;2;153;153;153mv2.1.173[27G[38;2;255;153;51m─────────────────────────────────────────────────────────────────────────────────────────────╮
[1B│[39m [2m[38;2;255;153;51m│[39m[22m [38;2;255;153;51m[1mTips for getting started[22m[39m [38;2;255;153;51m│
[1B│[39m [1mWelcome back Johan![54G[22m[2m[38;2;255;153;51m│[56G[39m[22mRun[60G/init[66Gto[69Gcreate[76Ga[78GCLAUDE.md[88Gfile[93Gwith[98Ginstructions[111Gfor[115GCla…[120G[38;2;255;153;51m│
[1B│[54G[2m│[56G[22m───────────────────────────────────────────────────────────────[120G│
[1B│[39m [24G[38;2;215;119;87m ▐[48;2;0;0;0m▛███▜[49m▌[54G[2m[38;2;255;153;51m│[56G[22m[1mWhat's new[120G[22m│
[1B│[24G[38;2;215;119;87m▝▜[48;2;0;0;0m█████[49m▛▘[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62GFable[68G5[70Gmodel[76Gnames[82Gwith[87Ga[89G`[1m]`[96Gsuffix[103Gnot[107Gbeing[113Gnorma…[120G[38;2;255;153;51m│
[1B│[39m [8G [15G [22G [38;2;215;119;87m ▘▘ ▝▝ [39m [40G [44G [52G [2m[38;2;255;153;51m│[39m[22m Fixed a spurious "sandbox depen[89Gncies missing"[104Gstartup warnin…[120G[38;2;255;153;51m│
[1B│[39m [38;2;153;153;153mOpus 4.8 (1M context) with xh… · Claude Team · [39m [2m[38;2;255;153;51m│[39m[22m Sub-ag[63Gnts can now[75Gspawn their own sub-agents[102G(up[106Gto[109G5[111Glevels[118G…[120G[38;2;255;153;51m│
[1B│[5G[38;2;153;153;153mBeehelp[54G[2m[38;2;255;153;51m│[56G[22m[38;2;153;153;153m[3m/release-notes for more[120G[23m[38;2;255;153;51m│
[1B│[39m [9G [17G [38;2;153;153;153m/tmp/spike-s3-bash2[39m [40G [44G [52G [2m[38;2;255;153;51m│[39m[22m [58G [120G[38;2;255;153;51m│
[1B╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
[1C[1B[39m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1B[39m❯ [2mTry "edit <filepath> to..."[22m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[2C[1B[38;2;153;153;153m? for shortcuts · ← for agents[102G◉ xhigh · /effort
[1B[39m[K[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[3A[K
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4A [38;2;255;204;0m⚠ 2 setup issues: MCP[38;2;153;153;153m · /doctor[39m[K
[1B[K
[1B [38;2;255;153;51m▎[39m Meet [38;2;255;153;51m[1mFable 5[22m[39m, our newest model for complex, long-running work. Try anytime with /model.[K
[1C[1B[38;2;255;153;51m▎[39m [38;2;153;153;153mIncluded in your[21Gplan limits until Jun 22, then switch to usage credits to continue.[102G[39m[K
|
|
||||||
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
❯
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153m?[5Gfor[9Gshortcuts[19G·[21G←[23Gfor[27Gagents[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[3ARun[7Gthis[12Gexact[18Gbash[23Gcommand[31Gand[35Gshow[40Gme[43Gits[47Goutput:[55Gnode[60G-e[63G"console.log('spike-s3-marker-xyz')"[100G—[102Gdo[105Gnot[109Gdo
[1B anything else.[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[102G[38;2;153;153;153m◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[16C[3A[?25h[?2026l]0;⠂ Claude Code[?2026h[?25l[16D[3B
[5A[48;2;55;55;55m[38;2;80;80;80m❯ [38;2;255;255;255mRun this exact bash command and show me its output: node -e "console.log('spike-s3-marker-xyz')" — do not do anything[39m
[1B [38;2;255;255;255melse.[39m
[2C[1B[49m[K
[1B[38;2;255;153;51m✽[39m [38;2;255;153;51mEnvisioning… [39m[K
[101C[1B[K
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;183;101mng…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;153;51mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[12C[6A[38;2;255;153;51mg…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Claude Code[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mEn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;183;101mv[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[3GE[6G[38;2;255;183;101mi[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;153;51mnv[7G[38;2;255;183;101msi[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[5C[6A[38;2;255;153;51mi[9G[38;2;255;183;101mo[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[7Gs[10G[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[7C[6A[38;2;255;153;51mi[11G[38;2;255;183;101mi[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Exécuter commande Node.js et afficher résultat[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[9Gon[12G[38;2;255;183;101mng[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[10C[6A[38;2;255;153;51mi[14G[38;2;255;183;101m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[12Gn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[12C[6A[38;2;255;153;51mg…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Exécuter commande Node.js et afficher résultat[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6C[6A[38;2;255;183;101msio[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[15C[6A[38;2;153;153;153m(2s · [38;2;185;185;185mthinking with xhigh effort[38;2;153;153;153m)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[6G[38;2;255;183;101mi[9G[38;2;255;153;51mo[22G[38;2;181;181;181mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Exécuter commande Node.js et afficher résultat[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[5G[38;2;255;183;101mv[8G[38;2;255;153;51mi[22G[38;2;177;177;177mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[21C[6A[38;2;173;173;173mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;183;101mn[7G[38;2;255;153;51ms[17G[38;2;153;153;153m3[22G[38;2;169;169;169mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[21C[6A[38;2;161;161;161mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[3G[38;2;255;183;101mE[6G[38;2;255;153;51mi[22G[38;2;157;157;157mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[21C[6A[38;2;153;153;153m↓[39m [38;2;153;153;153m25 tokens · thinking with xhigh effort)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;153;153;153m●[3G[39m[1mBash[22m(node -e "console.log('spike-s3-marker-xyz')")[K
[1B[38;2;153;153;153m ⎿ Waiting…
[1B[39m[K
[1B[38;2;255;153;51m✢[39m [38;2;255;183;101mEnv[38;2;255;153;51misioning… [38;2;153;153;153m(3s · ↓[24G25 tokens · thinking with xhigh effort)
[1B[39m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[5Gv[24G[38;2;153;153;153m50[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[9A[38;2;153;153;153m
[5C[1BRunn
[4C[2B[38;2;255;183;101mvisioning…[33G[38;2;153;153;153m)[39m[K
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[24G[38;2;153;153;153m75[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[9A[38;2;51;153;255m●
[5C[1B[39mspike-s3-marker-xyz
[2C[2B[38;2;255;153;51mEnvisioning…[22G[38;2;153;153;153m↑[24G88[33G · thinking with xhigh effort)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[24G[38;2;153;153;153m95[36G[38;2;157;157;157mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[23C[6A[38;2;153;153;153m101 tokens · [38;2;157;157;157mthinking with xhigh e[59Gfort[38;2;153;153;153m)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Exécuter commande Node.js et afficher résultat[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[25G[38;2;153;153;153m1[37G[38;2;161;161;161mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[25C[6A[38;2;153;153;153m5[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[25C[6A[38;2;153;153;153m8[37G[38;2;165;165;165mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[16C[6A[38;2;153;153;153m4[25G21[37G[38;2;169;169;169mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[25C[6A[38;2;153;153;153m2[37G[38;2;173;173;173mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[25C[6A[38;2;153;153;153m3[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[25C[6A[38;2;153;153;153m4[37G[38;2;177;177;177mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[26G[38;2;153;153;153m5[37G[38;2;181;181;181mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mEn[26G[38;2;153;153;153m6[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[5G[38;2;255;183;101mv[26G[38;2;153;153;153m7[37G[38;2;185;185;185mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;153;51mE[6G[38;2;255;183;101mi[26G[38;2;153;153;153m8[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[36C[6A[38;2;153;153;153mthought for 1s)[39m[K
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[4Gnv[7G[38;2;255;183;101msi[26G[38;2;153;153;153m9[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[5C[6A[38;2;255;153;51mi[9G[38;2;255;183;101mo[25G[38;2;153;153;153m30[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[7Gs[10G[38;2;255;183;101mn[26G[38;2;153;153;153m1[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Exécuter commande Node.js et afficher résultat[?2026h[?25l[2D[3B
[7C[6A[38;2;255;153;51mi[11G[38;2;255;183;101mi[26G[38;2;153;153;153m2[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[8C[6A[38;2;255;153;51mon[12G[38;2;255;183;101mng[26G[38;2;153;153;153m3[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[11Gi[14G[38;2;255;183;101m…[26G[38;2;153;153;153m4[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;153;51mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[12C[6A[38;2;255;153;51mg…[26G[38;2;153;153;153m6[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[16C[6A[38;2;153;153;153m5[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[21C[6A[38;2;153;153;153m↓[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Exécuter commande Node.js et afficher résultat[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;255;255m●[3G[39mSortie de la commande :[K
[2B spike-s3-marker-xyz[K
[1B[K
[1B[38;2;255;153;51m✽[39m [38;2;255;172;82mEnvisioning…[38;2;255;153;51m [38;2;153;153;153m(running stop hook · 5s · ↓[39m [38;2;153;153;153m136 tokens · thought for 1s)[39m[K
[2C[1B[K
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l]0;✳ Exécuter commande Node.js et afficher résultat[?2026h[?25l[2D[3B
[6A[38;2;153;153;153m✻[3GBrewed for 5s[39m[K
[3B❯
[2C[2B[38;2;153;153;153m? for shortcuts · ← for agents[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[101C[1A[K
|
|
||||||
[2C[3A[?25h[?2026l[?1006l[?1003l[?1002l[?1000l[2D[3B(B[>4m[<u[?1004l[?2031l[?2004l[?25h7[r8]0;[2m[22m
|
|
||||||
[2mResume this session with:[22m
|
|
||||||
[2mclaude --resume 614ec96a-bc4c-42d7-a18e-eb5d291540f1[22m
|
|
||||||
[2m[22m
|
|
||||||
@@ -1,469 +0,0 @@
|
|||||||
7[r8[?25h[?25l[?2004h[?1004h[?2031h[?2026h
|
|
||||||
[38;2;255;204;0m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[2G[38;2;255;204;0m[1mAccessing[12Gworkspace:[22m[39m
|
|
||||||
|
|
||||||
[2G[1m/tmp/spike-s3-write2[22m
|
|
||||||
|
|
||||||
[2GQuick[8Gsafety[15Gcheck:[22GIs[25Gthis[30Ga[32Gproject[40Gyou[44Gcreated[52Gor[55Gone[59Gyou[63Gtrust?[70G(Like[76Gyour[81Gown[85Gcode,[91Ga[93Gwell-known[104Gopen[109Gsource
|
|
||||||
[2Gproject,[11Gor[14Gwork[19Gfrom[24Gyour[29Gteam).[36GIf[39Gnot,[44Gtake[49Ga[51Gmoment[58Gto[61Greview[68Gwhat's[75Gin[78Gthis[83Gfolder[90Gfirst.
|
|
||||||
|
|
||||||
[2GClaude[9GCode'll[17Gbe[20Gable[25Gto[28Gread,[34Gedit,[40Gand[44Gexecute[52Gfiles[58Ghere.
|
|
||||||
|
|
||||||
[2G]8;id=zaxmda;https://code.claude.com/docs/en/security[38;2;153;153;153mSecurity guide[39m]8;;
|
|
||||||
|
|
||||||
[2G[38;2;153;204;255m❯[4G[38;2;153;153;153m1.[7G[38;2;153;204;255mYes,[12GI[14Gtrust[20Gthis[25Gfolder[39m
|
|
||||||
[4G[38;2;153;153;153m2.[7G[39mNo,[11Gexit
|
|
||||||
|
|
||||||
[2G[38;2;153;153;153mEnter[8Gto[11Gconfirm[19G·[21GEsc[25Gto[28Gcancel[39m
|
|
||||||
[1C[4A[?2026l[>0q[c[?2026h[1D[4B
[6C[4A[38;2;51;153;255mYes, I trust this folder[32G✔[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[1C[4A[?2026l]0;✳ Claude Code[?2026h[1D[4B[2K[G[1A
[16A[38;2;255;153;51m╭───[6GClaude Code[18G[38;2;153;153;153mv2.1.173[27G[38;2;255;153;51m─────────────────────────────────────────────────────────────────────────────────────────────╮
[1B│[39m [2m[38;2;255;153;51m│[39m[22m [38;2;255;153;51m[1mTips for getting started[22m[39m [38;2;255;153;51m│
[1B│[39m [1mWelcome back Johan![54G[22m[2m[38;2;255;153;51m│[56G[39m[22mRun[60G/init[66Gto[69Gcreate[76Ga[78GCLAUDE.md[88Gfile[93Gwith[98Ginstructions[111Gfor[115GCla…[120G[38;2;255;153;51m│
[1B│[54G[2m│[56G[22m───────────────────────────────────────────────────────────────[120G│
[1B│[39m [24G[38;2;215;119;87m ▐[48;2;0;0;0m▛███▜[49m▌[54G[2m[38;2;255;153;51m│[56G[22m[1mWhat's new[120G[22m│
[1B│[24G[38;2;215;119;87m▝▜[48;2;0;0;0m█████[49m▛▘[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62GFable[68G5[70Gmodel[76Gnames[82Gwith[87Ga[89G`[1m]`[96Gsuffix[103Gnot[107Gbeing[113Gnorma…[120G[38;2;255;153;51m│
[1B│[39m [8G [15G [22G [38;2;215;119;87m ▘▘ ▝▝ [39m [40G [44G [52G [2m[38;2;255;153;51m│[39m[22m Fixed a spurious "sandbox depen[89Gncies missing"[104Gstartup warnin…[120G[38;2;255;153;51m│
[1B│[39m [38;2;153;153;153mOpus 4.8 (1M context) with xh… · Claude Team · [39m [2m[38;2;255;153;51m│[39m[22m Sub-ag[63Gnts can now[75Gspawn their own sub-agents[102G(up[106Gto[109G5[111Glevels[118G…[120G[38;2;255;153;51m│
[1B│[5G[38;2;153;153;153mBeehelp[54G[2m[38;2;255;153;51m│[56G[22m[38;2;153;153;153m[3m/release-notes for more[120G[23m[38;2;255;153;51m│
[1B│[39m [9G [17G [38;2;153;153;153m/tmp/spike-s3-write2[39m [40G [44G [52G [2m[38;2;255;153;51m│[39m[22m [58G [120G[38;2;255;153;51m│
[1B╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
[1C[1B[39m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1B[39m❯ [2mTry "edit <filepath> to..."[22m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[2C[1B[38;2;153;153;153m? for shortcuts · ← for agents[102G◉ xhigh · /effort
[1B[39m[K[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[3A[K
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4A [38;2;255;204;0m⚠ 2 setup issues: MCP[38;2;153;153;153m · /doctor[39m[K
[1B[K
[1B [38;2;255;153;51m▎[39m Meet [38;2;255;153;51m[1mFable 5[22m[39m, our newest model for complex, long-running work. Try anytime with /model.[K
[1C[1B[38;2;255;153;51m▎[39m [38;2;153;153;153mIncluded in your[21Gplan limits until Jun 22, then switch to usage credits to continue.[102G[39m[K
|
|
||||||
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
❯ Create[10Ga[12Gfile[17Gnamed[23Gs3-edit.txt[35Gcontaining[46Gexactly[54Gthe[58Gword[63Ghello.[70GUse[74Gthe[78GWrite[84Gtool.[90GDo[93Gnot[97Gdo[100Ganything[109Gelse.
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[102G[38;2;153;153;153m◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[113C[3A[?25h[?2026l]0;⠂ Claude Code[?2026h[?25l[113D[3B
[4A[48;2;55;55;55m[38;2;80;80;80m❯ [38;2;255;255;255mCreate a file named s3-edit.txt containing exactly the word hello. Use the Write tool. Do not do anything else.[39m
[1B[49m[K
[1B[38;2;255;153;51m✽[39m [38;2;255;153;51mSwooping… [39m[K
[101C[1B[K
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Claude Code[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mS[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[3C[6A[38;2;255;183;101mw[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;183;101mo[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;153;51mSw[6G[38;2;255;183;101mop[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;153;51mo[8G[38;2;255;183;101mi[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[6Go[9G[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6C[6A[38;2;255;153;51mpi[10G[38;2;255;183;101mg…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[8C[6A[38;2;255;153;51mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Créer un fichier s3-edit.txt avec hello[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[10Gg[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[10C[6A[38;2;255;153;51m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Créer un fichier s3-edit.txt avec hello[?2026h[?25l[2D[3B
[6C[6A[38;2;255;183;101mpin[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[12C[6A[38;2;153;153;153m(1s · thinking with xhigh effort)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[5C[6A[38;2;255;183;101mo[9G[38;2;255;153;51mn[14G[38;2;153;153;153m2[19G[38;2;169;169;169mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[18C[6A[38;2;177;177;177mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[5G[38;2;255;183;101mo[8G[38;2;255;153;51mi[19G[38;2;181;181;181mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[18C[6A[38;2;185;185;185mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[4G[38;2;255;183;101mw[7G[38;2;255;153;51mp[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[19G[38;2;153;153;153m↓[39m [38;2;153;153;153m25 tokens · [38;2;185;185;185mt[36Gnking wi[45Gh xhigh effort[38;2;153;153;153m)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[3G[38;2;255;183;101mS[6G[38;2;255;153;51mo[21G[38;2;153;153;153m57[33G[38;2;181;181;181mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Créer un fichier s3-edit.txt avec hello[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[5Go[21G[38;2;153;153;153m68[33G[38;2;177;177;177mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[20C[6A[38;2;153;153;153m76[33G[38;2;173;173;173mthinking with xhigh effort[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;✳ Créer un fichier s3-edit.txt avec hello[?2026h[?25l[2D[3B
[6A[38;2;153;153;153m●[3G[39m[1mWrite[22m(]8;id=vlvau2;file:///tmp/spike-s3-write2/s3-edit.txts3-edit.txt]8;;)[K
[2B[38;2;153;204;255m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1B[39m [38;2;153;204;255m[1mCreate file
[1B[22m[39m [38;2;153;153;153ms3-edit.txt[39m[K
[1B[38;2;80;80;80m╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌[39m
|
|
||||||
[2G[38;2;248;248;242m[2m 1[5G[22mhello[39m
|
|
||||||
[38;2;80;80;80m╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌[39m
|
|
||||||
[2GDo[5Gyou[9Gwant[14Gto[17Gcreate[24G[1ms3-edit.txt[22m?
|
|
||||||
[2G[38;2;153;204;255m❯[4G[38;2;153;153;153m1.[7G[38;2;153;204;255mYes[39m
|
|
||||||
[4G[38;2;153;153;153m2.[7G[39mYes,[12Gallow[18Gall[22Gedits[28Gduring[35Gthis[40Gsession[48G[1m(shift+tab)[22m
|
|
||||||
[4G[38;2;153;153;153m3.[7G[39mNo
|
|
||||||
|
|
||||||
[2G[38;2;153;153;153mEsc[6Gto[9Gcancel[16G·[18GTab[22Gto[25Gamend[39m
|
|
||||||
[1C[5A[?2026l]0;⠐ Créer un fichier s3-edit.txt avec hello[?2026h[1D[5B[H[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[H[38;2;255;153;51m╭───[6GClaude[13GCode[18G[38;2;153;153;153mv2.1.173[27G[38;2;255;153;51m─────────────────────────────────────────────────────────────────────────────────────────────╮[39m
|
|
||||||
[38;2;255;153;51m│[54G[2m│[56G[22m[1mTips[61Gfor[65Ggetting[73Gstarted[120G[22m│[39m
|
|
||||||
[38;2;255;153;51m│[19G[39m[1mWelcome[27Gback[32GJohan![54G[22m[2m[38;2;255;153;51m│[56G[39m[22mRun[60G/init[66Gto[69Gcreate[76Ga[78GCLAUDE.md[88Gfile[93Gwith[98Ginstructions[111Gfor[115GCla…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[54G[2m│[56G[22m───────────────────────────────────────────────────────────────[120G│[39m
|
|
||||||
[38;2;255;153;51m│[24G[38;2;215;119;87m ▐[48;2;0;0;0m▛███▜[49m▌[54G[2m[38;2;255;153;51m│[56G[22m[1mWhat's[63Gnew[120G[22m│[39m
|
|
||||||
[38;2;255;153;51m│[24G[38;2;215;119;87m▝▜[48;2;0;0;0m█████[49m▛▘[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62GFable[68G5[70Gmodel[76Gnames[82Gwith[87Ga[89G`[1m]`[96Gsuffix[103Gnot[107Gbeing[113Gnorma…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[24G[38;2;215;119;87m [26G▘▘[29G▝▝[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62Ga[64Gspurious[73G"sandbox[82Gdependencies[95Gmissing"[104Gstartup[112Gwarnin…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[5G[38;2;153;153;153mOpus[10G4.8[14G(1M[18Gcontext)[27Gwith[32Gxh…[36G·[38GClaude[45GTeam[50G·[54G[2m[38;2;255;153;51m│[56G[39m[22mSub-agents[67Gcan[71Gnow[75Gspawn[81Gtheir[87Gown[91Gsub-agents[102G(up[106Gto[109G5[111Glevels[118G…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[5G[38;2;153;153;153mBeehelp[54G[2m[38;2;255;153;51m│[56G[22m[38;2;153;153;153m[3m/release-notes[71Gfor[75Gmore[120G[23m[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[18G[38;2;153;153;153m/tmp/spike-s3-write2[54G[2m[38;2;255;153;51m│[120G[22m│[39m
|
|
||||||
[38;2;255;153;51m╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[39m
|
|
||||||
|
|
||||||
[2G[38;2;255;204;0m⚠[4G2[6Gsetup[12Gissues:[20GMCP[38;2;153;153;153m ·[26G/doctor[39m
|
|
||||||
|
|
||||||
[2G[38;2;255;153;51m▎[4G[39mMeet[9G[38;2;255;153;51m[1mFable[15G5[22m[39m,[18Gour[22Gnewest[29Gmodel[35Gfor[39Gcomplex,[48Glong-running[61Gwork.[67GTry[71Ganytime[79Gwith[84G/model.
|
|
||||||
[2G[38;2;255;153;51m▎[4G[38;2;153;153;153mIncluded[13Gin[16Gyour[21Gplan[26Glimits[33Guntil[39GJun[43G22,[47Gthen[52Gswitch[59Gto[62Gusage[68Gcredits[76Gto[79Gcontinue.[39m
|
|
||||||
|
|
||||||
[48;2;55;55;55m[38;2;80;80;80m❯ [38;2;255;255;255mCreate a file named s3-edit.txt containing exactly the word hello. Use the Write tool. Do not do anything else.[39m [49m
|
|
||||||
|
|
||||||
[38;2;153;153;153m●[3G[39m[1mWrite[22m(]8;id=vlvau2;file:///tmp/spike-s3-write2/s3-edit.txts3-edit.txt]8;;)
|
|
||||||
|
|
||||||
[38;2;255;153;51m✻[3G[38;2;255;157;57mSeasoning…[38;2;255;153;51m [38;2;153;153;153m(3s[18G·[20G↓[22G147[26Gtokens)[39m
|
|
||||||
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[38;2;153;153;153m❯ [39m
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[21G[38;2;255;204;0mYou've[28Gused[33G91%[37Gof[40Gyour[45Gsession[53Glimit[59G·[61Gresets[68G7pm[72G(Europe/Paris)[87G·[89G/usage-credits[104Gto[107Grequest[115Gmore[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[3GSeasoning…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[8A[38;2;51;153;255m●
[1B[38;2;153;153;153m ⎿ [39mWrote[12G[1m1[14G[22mlines[20Gto[23G[1ms3-edit.txt
[1B[22m [3G [38;2;248;248;242m[2m 1 [22mhello[39m[K
[2B[38;2;255;153;51m✶[39m [38;2;255;153;51mSeason[38;2;255;183;101ming[38;2;255;153;51m… [38;2;153;153;153m(3s · ↑[39m [38;2;153;153;153m147 tokens)[39m[K
[1B[K
[2B[38;2;153;153;153m❯ [39m[K
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[21G[38;2;255;204;0mYou've[28Gused[33G91%[37Gof[40Gyour[45Gsession[53Glimit[59G·[61Gresets[68G7pm[72G(Europe/Paris)[87G·[89G/usage-credits[104Gto[107Grequest[115Gmore[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[8C[6A[38;2;255;153;51mi[12G[38;2;255;183;101m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[10Gng[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;153;51m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Créer un fichier s3-edit.txt avec hello[?2026h[?25l[2D[3B
[14C[6A[38;2;153;153;153m4[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;183;101mS[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[4G[38;2;255;183;101me[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;183;101ma[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[3GSe[6G[38;2;255;183;101mso[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4C[6A[38;2;255;153;51ma[8G[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[5C[6A[38;2;255;153;51ms[9G[38;2;255;183;101mi[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✽[7Go[10G[38;2;255;183;101mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[7C[6A[38;2;255;153;51mni[11G[38;2;255;183;101mg…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[9C[6A[38;2;255;153;51mn[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[10C[6A[38;2;255;153;51mg[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;153;51m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✻[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠐ Créer un fichier s3-edit.txt avec hello[?2026h[?25l[2D[3B
[14C[6A[38;2;153;153;153m5[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✶[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m*[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m·[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[19C[6A[38;2;153;153;153m↓[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[11C[6A[38;2;255;183;101m…[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;⠂ Créer un fichier s3-edit.txt avec hello[?2026h[?25l[2D[3B
[6A[38;2;255;255;255m●[3G[39mFichier [38;2;153;204;255ms3-edit.txt[39m créé avec le[36Gcontenu[44G[38;2;153;204;255mhello[39m.
[2B[38;2;255;153;51m·[39m [38;2;255;153;51mSeasoning[38;2;255;183;101m…[38;2;255;153;51m [38;2;153;153;153m(5s · ↓[39m [38;2;153;153;153m147 tokens)[39m[K
[1B[K
[2B[38;2;153;153;153m❯ [39m[K
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153mesc[7Gto[10Ginterrupt[21G[38;2;255;204;0mYou've[28Gused[33G91%[37Gof[40Gyour[45Gsession[53Glimit[59G·[61Gresets[68G7pm[72G(Europe/Paris)[87G·[89G/usage-credits[104Gto[107Grequest[115Gmore[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[6A[38;2;255;153;51m✢[11G[38;2;255;183;101mg[15G[38;2;153;153;153m6[24G9[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[6A[38;2;255;179;95mSeasoning…[15G[38;2;153;153;153mrunning stop hook · 6s · ↓[42G149 tokens)[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l]0;✳ Créer un fichier s3-edit.txt avec hello[?2026h[?25l[2D[3B
[6A[38;2;153;153;153m✻[3GCooked for 6s[39m[K
[3B❯
[2C[2B[38;2;153;153;153m? for shortcuts · ← for agents[39m[K
|
|
||||||
[21G[38;2;255;204;0mYou've[28Gused[33G91%[37Gof[40Gyour[45Gsession[53Glimit[59G·[61Gresets[68G7pm[72G(Europe/Paris)[87G·[89G/usage-credits[104Gto[107Grequest[115Gmore[39m
|
|
||||||
[2C[4A[?25h[?2026l[?2026h[?25l[2D[4B[H[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[2K[1B[H[38;2;255;153;51m╭───[6GClaude[13GCode[18G[38;2;153;153;153mv2.1.173[27G[38;2;255;153;51m─────────────────────────────────────────────────────────────────────────────────────────────╮[39m
|
|
||||||
[38;2;255;153;51m│[54G[2m│[56G[22m[1mTips[61Gfor[65Ggetting[73Gstarted[120G[22m│[39m
|
|
||||||
[38;2;255;153;51m│[19G[39m[1mWelcome[27Gback[32GJohan![54G[22m[2m[38;2;255;153;51m│[56G[39m[22mRun[60G/init[66Gto[69Gcreate[76Ga[78GCLAUDE.md[88Gfile[93Gwith[98Ginstructions[111Gfor[115GCla…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[54G[2m│[56G[22m───────────────────────────────────────────────────────────────[120G│[39m
|
|
||||||
[38;2;255;153;51m│[24G[38;2;215;119;87m ▐[48;2;0;0;0m▛███▜[49m▌[54G[2m[38;2;255;153;51m│[56G[22m[1mWhat's[63Gnew[120G[22m│[39m
|
|
||||||
[38;2;255;153;51m│[24G[38;2;215;119;87m▝▜[48;2;0;0;0m█████[49m▛▘[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62GFable[68G5[70Gmodel[76Gnames[82Gwith[87Ga[89G`[1m]`[96Gsuffix[103Gnot[107Gbeing[113Gnorma…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[24G[38;2;215;119;87m [26G▘▘[29G▝▝[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62Ga[64Gspurious[73G"sandbox[82Gdependencies[95Gmissing"[104Gstartup[112Gwarnin…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[5G[38;2;153;153;153mOpus[10G4.8[14G(1M[18Gcontext)[27Gwith[32Gxh…[36G·[38GClaude[45GTeam[50G·[54G[2m[38;2;255;153;51m│[56G[39m[22mSub-agents[67Gcan[71Gnow[75Gspawn[81Gtheir[87Gown[91Gsub-agents[102G(up[106Gto[109G5[111Glevels[118G…[120G[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[5G[38;2;153;153;153mBeehelp[54G[2m[38;2;255;153;51m│[56G[22m[38;2;153;153;153m[3m/release-notes[71Gfor[75Gmore[120G[23m[38;2;255;153;51m│[39m
|
|
||||||
[38;2;255;153;51m│[18G[38;2;153;153;153m/tmp/spike-s3-write2[54G[2m[38;2;255;153;51m│[120G[22m│[39m
|
|
||||||
[38;2;255;153;51m╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯[39m
|
|
||||||
|
|
||||||
[2G[38;2;255;204;0m⚠[4G2[6Gsetup[12Gissues:[20GMCP[38;2;153;153;153m ·[26G/doctor[39m
|
|
||||||
|
|
||||||
[2G[38;2;255;153;51m▎[4G[39mMeet[9G[38;2;255;153;51m[1mFable[15G5[22m[39m,[18Gour[22Gnewest[29Gmodel[35Gfor[39Gcomplex,[48Glong-running[61Gwork.[67GTry[71Ganytime[79Gwith[84G/model.
|
|
||||||
[2G[38;2;255;153;51m▎[4G[38;2;153;153;153mIncluded[13Gin[16Gyour[21Gplan[26Glimits[33Guntil[39GJun[43G22,[47Gthen[52Gswitch[59Gto[62Gusage[68Gcredits[76Gto[79Gcontinue.[39m
|
|
||||||
|
|
||||||
[48;2;55;55;55m[38;2;80;80;80m❯ [38;2;255;255;255mCreate a file named s3-edit.txt containing exactly the word hello. Use the Write tool. Do not do anything else.[39m [49m
|
|
||||||
|
|
||||||
[38;2;51;153;255m●[3G[39m[1mWrite[22m(]8;id=vlvau2;file:///tmp/spike-s3-write2/s3-edit.txts3-edit.txt]8;;)
|
|
||||||
[38;2;153;153;153m [3G⎿[5G [39mWrote[12G[1m1[14G[22mlines[20Gto[23G[1ms3-edit.txt[22m
|
|
||||||
[6G[38;2;248;248;242m[2m 1[9G[22mhello[39m
|
|
||||||
|
|
||||||
[38;2;255;255;255m●[3G[39mFichier[11G[38;2;153;204;255ms3-edit.txt[23G[39mcréé[28Gavec[33Gle[36Gcontenu[44G[38;2;153;204;255mhello[39m.
|
|
||||||
|
|
||||||
[38;2;153;153;153m✻[3GCooked[10Gfor[14G6s[39m
|
|
||||||
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
❯
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153m?[5Gfor[9Gshortcuts[19G·[21G←[23Gfor[27Gagents[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[101C[1A[K
|
|
||||||
[2C[3A[?25h[?2026l[?1006l[?1003l[?1002l[?1000l[2D[3B(B[>4m[<u[?1004l[?2031l[?2004l[?25h7[r8]0;[2m[22m
|
|
||||||
[2mResume this session with:[22m
|
|
||||||
[2mclaude --resume 4c722fa4-a25b-4cbd-9435-d98ec8cf2a50[22m
|
|
||||||
[2m[22m
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
7[r8[?25h[?25l[?2004h[?1004h[?2031h[?2026h
|
|
||||||
[38;2;255;204;0m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[2G[38;2;255;204;0m[1mAccessing[12Gworkspace:[22m[39m
|
|
||||||
|
|
||||||
[2G[1m/tmp/spike-s3-trust[22m
|
|
||||||
|
|
||||||
[2GQuick[8Gsafety[15Gcheck:[22GIs[25Gthis[30Ga[32Gproject[40Gyou[44Gcreated[52Gor[55Gone[59Gyou[63Gtrust?[70G(Like[76Gyour[81Gown[85Gcode,[91Ga[93Gwell-known[104Gopen[109Gsource
|
|
||||||
[2Gproject,[11Gor[14Gwork[19Gfrom[24Gyour[29Gteam).[36GIf[39Gnot,[44Gtake[49Ga[51Gmoment[58Gto[61Greview[68Gwhat's[75Gin[78Gthis[83Gfolder[90Gfirst.
|
|
||||||
|
|
||||||
[2GClaude[9GCode'll[17Gbe[20Gable[25Gto[28Gread,[34Gedit,[40Gand[44Gexecute[52Gfiles[58Ghere.
|
|
||||||
|
|
||||||
[2G]8;id=zaxmda;https://code.claude.com/docs/en/security[38;2;153;153;153mSecurity guide[39m]8;;
|
|
||||||
|
|
||||||
[2G[38;2;153;204;255m❯[4G[38;2;153;153;153m1.[7G[38;2;153;204;255mYes,[12GI[14Gtrust[20Gthis[25Gfolder[39m
|
|
||||||
[4G[38;2;153;153;153m2.[7G[39mNo,[11Gexit
|
|
||||||
|
|
||||||
[2G[38;2;153;153;153mEnter[8Gto[11Gconfirm[19G·[21GEsc[25Gto[28Gcancel[39m
|
|
||||||
[1C[4A[?2026l[>0q[c[?2026h[1D[4B
[6C[4A[38;2;51;153;255mYes, I trust this folder[32G✔[39m
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[1C[4A[?2026l]0;✳ Claude Code[?2026h[1D[4B[2K[G[1A
[16A[38;2;255;153;51m╭───[6GClaude Code[18G[38;2;153;153;153mv2.1.173[27G[38;2;255;153;51m─────────────────────────────────────────────────────────────────────────────────────────────╮
[1B│[39m [2m[38;2;255;153;51m│[39m[22m [38;2;255;153;51m[1mTips for getting started[22m[39m [38;2;255;153;51m│
[1B│[39m [1mWelcome back Johan![54G[22m[2m[38;2;255;153;51m│[56G[39m[22mRun[60G/init[66Gto[69Gcreate[76Ga[78GCLAUDE.md[88Gfile[93Gwith[98Ginstructions[111Gfor[115GCla…[120G[38;2;255;153;51m│
[1B│[54G[2m│[56G[22m───────────────────────────────────────────────────────────────[120G│
[1B│[39m [24G[38;2;215;119;87m ▐[48;2;0;0;0m▛███▜[49m▌[54G[2m[38;2;255;153;51m│[56G[22m[1mWhat's new[120G[22m│
[1B│[24G[38;2;215;119;87m▝▜[48;2;0;0;0m█████[49m▛▘[54G[2m[38;2;255;153;51m│[56G[39m[22mFixed[62GFable[68G5[70Gmodel[76Gnames[82Gwith[87Ga[89G`[1m]`[96Gsuffix[103Gnot[107Gbeing[113Gnorma…[120G[38;2;255;153;51m│
[1B│[39m [8G [15G [22G [38;2;215;119;87m ▘▘ ▝▝ [39m [40G [44G [52G [2m[38;2;255;153;51m│[39m[22m Fixed a spurious "sandbox depen[89Gncies missing"[104Gstartup warnin…[120G[38;2;255;153;51m│
[1B│[39m [38;2;153;153;153mOpus 4.8 (1M context) with xh… · Claude Team · [39m [2m[38;2;255;153;51m│[39m[22m Sub-ag[63Gnts can now[75Gspawn their own sub-agents[102G(up[106Gto[109G5[111Glevels[118G…[120G[38;2;255;153;51m│
[1B│[5G[38;2;153;153;153mBeehelp[54G[2m[38;2;255;153;51m│[56G[22m[38;2;153;153;153m[3m/release-notes for more[120G[23m[38;2;255;153;51m│
[1B│[39m [9G [17G [38;2;153;153;153m/tmp/spike-s3-trust[39m [40G [44G [52G [2m[38;2;255;153;51m│[39m[22m [58G [120G[38;2;255;153;51m│
[1B╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
[1C[1B[39m[K
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1B[39m❯ [2mTry "create a util logging.py that..."
[1B[22m[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[2C[1B[38;2;153;153;153m? for shortcuts · ← for agents[102G◉ xhigh · /effort
[1B[39m[K[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[2C[3A[K
|
|
||||||
|
|
||||||
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4A [38;2;255;204;0m⚠ 2 setup issues: MCP[38;2;153;153;153m · /doctor[39m[K
[1B[K
[1B [38;2;255;153;51m▎[39m Meet [38;2;255;153;51m[1mFable 5[22m[39m, our newest model for complex, long-running work. Try anytime with /model.[K
[1C[1B[38;2;255;153;51m▎[39m [38;2;153;153;153mIncluded in your[21Gplan limits until Jun 22, then switch to usage credits to continue.[102G[39m[K
|
|
||||||
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
❯
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153m?[5Gfor[9Gshortcuts[19G·[21G←[23Gfor[27Gagents[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B[2K[1A[2K[1A[2K[1A[2K[1A[2K[G[1A
[4A[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1B[39m❯
[1B[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[1C[1B[39m [38;2;153;153;153m? for shortcuts ·[21G← for agents[39m [102G[38;2;153;153;153m◉ xhigh · /effort
[1B[39m[K
[1B[K
[1B[K
[1B[K
[1B[K
[4A[2C[3A[?25h[?2026l[?2026h[?25l[2D[3B
[4A [38;2;255;204;0m⚠ 2 setup issues: MCP[38;2;153;153;153m · /doctor[39m[K
[1B[K
[1B [38;2;255;153;51m▎[39m Meet [38;2;255;153;51m[1mFable 5[22m[39m, our newest model for complex, long-running work. Try anytime with /model.[K
[1C[1B[38;2;255;153;51m▎[39m [38;2;153;153;153mIncluded in your[21Gplan limits until Jun 22, then switch to usage credits to continue.[102G[39m[K
|
|
||||||
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
❯
|
|
||||||
[38;2;136;136;136m────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────[39m
|
|
||||||
[3G[38;2;153;153;153m?[5Gfor[9Gshortcuts[19G·[21G←[23Gfor[27Gagents[102G◉[104Gxhigh[110G·[112G/effort[39m
|
|
||||||
[2C[3A[?25h[?2026l[?1006l[?1003l[?1002l[?1000l[2D[3B(B[>4m[<u[?1004l[?2031l[?2004l[?25h7[r8]0;
|
|
||||||
@@ -1,143 +0,0 @@
|
|||||||
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
|
|
||||||
import { tmpdir } from 'node:os';
|
|
||||||
import { join } from 'node:path';
|
|
||||||
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
|
|
||||||
import { buildApp, type AppBundle } from '../src/app.js';
|
|
||||||
import { openDb, type Db } from '../src/db/index.js';
|
|
||||||
import type { Config } from '../src/config.js';
|
|
||||||
import type { FsListResponse } from '@arboretum/shared';
|
|
||||||
|
|
||||||
// Mêmes stubs que app.e2e : pas de vrai claude ni de vrai PTY en CI.
|
|
||||||
vi.mock('node:child_process', () => ({ execFileSync: () => '/usr/bin/claude\n' }));
|
|
||||||
vi.mock('@homebridge/node-pty-prebuilt-multiarch', () => {
|
|
||||||
class FakePty {
|
|
||||||
pid = 424242;
|
|
||||||
write = vi.fn();
|
|
||||||
resize = vi.fn();
|
|
||||||
pause = vi.fn();
|
|
||||||
resume = vi.fn();
|
|
||||||
kill = vi.fn();
|
|
||||||
onData(): { dispose: () => void } {
|
|
||||||
return { dispose: () => {} };
|
|
||||||
}
|
|
||||||
onExit(): { dispose: () => void } {
|
|
||||||
return { dispose: () => {} };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return { default: { spawn: (): FakePty => new FakePty() } };
|
|
||||||
});
|
|
||||||
|
|
||||||
process.env.ARBORETUM_LOG = 'silent';
|
|
||||||
|
|
||||||
let dir: string;
|
|
||||||
let root: string;
|
|
||||||
let bundle: AppBundle;
|
|
||||||
let db: Db;
|
|
||||||
let token: string;
|
|
||||||
|
|
||||||
const auth = (): { authorization: string } => ({ authorization: `Bearer ${token}` });
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
dir = mkdtempSync(join(tmpdir(), 'arboretum-fs-'));
|
|
||||||
// Arbo de test : root/{alpha, Beta, .hidden, a-repo/.git, file.txt}
|
|
||||||
root = join(dir, 'root');
|
|
||||||
mkdirSync(join(root, 'alpha'), { recursive: true });
|
|
||||||
mkdirSync(join(root, 'Beta'), { recursive: true });
|
|
||||||
mkdirSync(join(root, '.hidden'), { recursive: true });
|
|
||||||
mkdirSync(join(root, 'a-repo', '.git'), { recursive: true });
|
|
||||||
writeFileSync(join(root, 'file.txt'), 'x');
|
|
||||||
|
|
||||||
const dbPath = join(dir, 'fs.db');
|
|
||||||
db = openDb(dbPath);
|
|
||||||
const config: Config = {
|
|
||||||
port: 7317,
|
|
||||||
bind: '127.0.0.1',
|
|
||||||
dbPath,
|
|
||||||
dataDir: dir,
|
|
||||||
allowedOrigins: [],
|
|
||||||
printToken: false,
|
|
||||||
claudeProjectsDir: join(dir, 'claude', 'projects'),
|
|
||||||
claudeSessionsDir: join(dir, 'claude', 'sessions'),
|
|
||||||
vapidContact: 'mailto:test@localhost',
|
|
||||||
};
|
|
||||||
bundle = buildApp(config, db, '0.0.0-test');
|
|
||||||
const t = bundle.auth.ensureBootstrapToken();
|
|
||||||
if (!t) throw new Error('bootstrap token attendu sur une base vierge');
|
|
||||||
token = t;
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async () => {
|
|
||||||
await bundle.app.close();
|
|
||||||
db.close();
|
|
||||||
rmSync(dir, { recursive: true, force: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('GET /api/v1/fs/list', () => {
|
|
||||||
it('liste les sous-dossiers triés, masque les dotfiles et les fichiers', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: `/api/v1/fs/list?path=${encodeURIComponent(root)}`, headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(200);
|
|
||||||
const body = res.json() as FsListResponse;
|
|
||||||
const names = body.entries.map((e) => e.name);
|
|
||||||
expect(names).toEqual(['a-repo', 'alpha', 'Beta']); // tri insensible à la casse, fichiers/dotfiles exclus
|
|
||||||
expect(body.path).toBe(root);
|
|
||||||
expect(body.parent).toBe(dir);
|
|
||||||
expect(typeof body.home).toBe('string');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('showHidden=1 inclut les dossiers cachés', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: `/api/v1/fs/list?path=${encodeURIComponent(root)}&showHidden=1`, headers: auth() });
|
|
||||||
const body = res.json() as FsListResponse;
|
|
||||||
expect(body.entries.map((e) => e.name)).toContain('.hidden');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('markRepos=1 annote le dossier contenant un .git', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: `/api/v1/fs/list?path=${encodeURIComponent(root)}&markRepos=1`, headers: auth() });
|
|
||||||
const body = res.json() as FsListResponse;
|
|
||||||
expect(body.entries.find((e) => e.name === 'a-repo')?.isRepo).toBe(true);
|
|
||||||
expect(body.entries.find((e) => e.name === 'alpha')?.isRepo).toBeUndefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('sans markRepos, aucune annotation isRepo', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: `/api/v1/fs/list?path=${encodeURIComponent(root)}`, headers: auth() });
|
|
||||||
const body = res.json() as FsListResponse;
|
|
||||||
expect(body.entries.every((e) => e.isRepo === undefined)).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('path absent → liste le home (réponse 200 cohérente)', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/fs/list', headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(200);
|
|
||||||
const body = res.json() as FsListResponse;
|
|
||||||
expect(body.path).toBe(body.home);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('chemin relatif → 400 BAD_PATH', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/fs/list?path=relatif/x', headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(400);
|
|
||||||
expect(res.json()).toMatchObject({ error: { code: 'BAD_PATH' } });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('échappement par `..` neutralisé : resolve clampe, pas de fuite (200 sur un dossier réel)', async () => {
|
|
||||||
// `<root>/../..` résout vers un ancêtre réel : la requête réussit mais ne contient jamais de `..`.
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: `/api/v1/fs/list?path=${encodeURIComponent(join(root, '..', '..'))}`, headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(200);
|
|
||||||
expect((res.json() as FsListResponse).path).not.toContain('..');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('chemin inexistant → 404 NOT_FOUND', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: `/api/v1/fs/list?path=${encodeURIComponent(join(root, 'nope-xyz'))}`, headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(404);
|
|
||||||
expect(res.json()).toMatchObject({ error: { code: 'NOT_FOUND' } });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('cible non-dossier → 400 NOT_A_DIRECTORY', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: `/api/v1/fs/list?path=${encodeURIComponent(join(root, 'file.txt'))}`, headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(400);
|
|
||||||
expect(res.json()).toMatchObject({ error: { code: 'NOT_A_DIRECTORY' } });
|
|
||||||
});
|
|
||||||
|
|
||||||
it('sans authentification → 401', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: `/api/v1/fs/list?path=${encodeURIComponent(root)}` });
|
|
||||||
expect(res.statusCode).toBe(401);
|
|
||||||
expect(res.json()).toMatchObject({ error: { code: 'UNAUTHORIZED' } });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
import { describe, expect, it, beforeEach, vi } from 'vitest';
|
|
||||||
import { GroupManager } from '../src/core/group-manager.js';
|
|
||||||
import { openDb, type Db } from '../src/db/index.js';
|
|
||||||
|
|
||||||
/** Insère un repo minimal directement (le GroupManager n'a besoin que de repos.id). */
|
|
||||||
function insertRepo(db: Db, id: string, path: string): void {
|
|
||||||
db.prepare(
|
|
||||||
"INSERT INTO repos (id, path, label, default_branch, post_create_hooks, pre_trust, created_at) VALUES (?, ?, ?, NULL, '[]', 0, ?)",
|
|
||||||
).run(id, path, id, new Date().toISOString());
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('GroupManager', () => {
|
|
||||||
let db: Db;
|
|
||||||
let gm: GroupManager;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
db = openDb(':memory:');
|
|
||||||
insertRepo(db, 'repo-a', '/tmp/a');
|
|
||||||
insertRepo(db, 'repo-b', '/tmp/b');
|
|
||||||
gm = new GroupManager(db);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('createGroup : groupe vide, persisté, événement group_update émis', () => {
|
|
||||||
const spy = vi.fn();
|
|
||||||
gm.on('group_update', spy);
|
|
||||||
const g = gm.createGroup({ label: 'Sprint 42' });
|
|
||||||
expect(g).toMatchObject({ label: 'Sprint 42', description: null, color: null, repoIds: [] });
|
|
||||||
expect(gm.listGroups()).toHaveLength(1);
|
|
||||||
expect(spy).toHaveBeenCalledWith(expect.objectContaining({ id: g.id }));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('createGroup : repoIds initiaux ordonnés et dédoublonnés', () => {
|
|
||||||
const g = gm.createGroup({ label: 'Eco', repoIds: ['repo-b', 'repo-a', 'repo-b'] });
|
|
||||||
expect(g.repoIds).toEqual(['repo-b', 'repo-a']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('createGroup : repoId inexistant → 404', () => {
|
|
||||||
expect(() => gm.createGroup({ label: 'X', repoIds: ['nope'] })).toThrow(
|
|
||||||
expect.objectContaining({ statusCode: 404, code: 'REPO_NOT_FOUND' }),
|
|
||||||
);
|
|
||||||
expect(gm.listGroups()).toHaveLength(0); // rollback de la transaction
|
|
||||||
});
|
|
||||||
|
|
||||||
it('createGroup : validations (label vide / trop long, couleur invalide)', () => {
|
|
||||||
expect(() => gm.createGroup({ label: ' ' })).toThrow(expect.objectContaining({ statusCode: 400 }));
|
|
||||||
expect(() => gm.createGroup({ label: 'x'.repeat(101) })).toThrow(expect.objectContaining({ statusCode: 400 }));
|
|
||||||
expect(() => gm.createGroup({ label: 'X', color: 'red' })).toThrow(expect.objectContaining({ statusCode: 400 }));
|
|
||||||
expect(gm.createGroup({ label: 'X', color: '#4f46e5' }).color).toBe('#4f46e5');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('getGroup : id inconnu → 404', () => {
|
|
||||||
expect(() => gm.getGroup('nope')).toThrow(expect.objectContaining({ statusCode: 404, code: 'NOT_FOUND' }));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('updateGroup : modifie label/description/color et bump updatedAt', () => {
|
|
||||||
const g = gm.createGroup({ label: 'A' });
|
|
||||||
const updated = gm.updateGroup(g.id, { label: 'B', description: 'hello', color: '#000000' });
|
|
||||||
expect(updated).toMatchObject({ label: 'B', description: 'hello', color: '#000000' });
|
|
||||||
expect(gm.updateGroup(g.id, { description: '' }).description).toBeNull(); // '' → null
|
|
||||||
});
|
|
||||||
|
|
||||||
it('addRepo : idempotent (PRIMARY KEY), émet group_update', () => {
|
|
||||||
const g = gm.createGroup({ label: 'A' });
|
|
||||||
const spy = vi.fn();
|
|
||||||
gm.on('group_update', spy);
|
|
||||||
expect(gm.addRepo(g.id, 'repo-a').repoIds).toEqual(['repo-a']);
|
|
||||||
expect(gm.addRepo(g.id, 'repo-a').repoIds).toEqual(['repo-a']); // pas de doublon
|
|
||||||
expect(gm.addRepo(g.id, 'repo-b').repoIds).toEqual(['repo-a', 'repo-b']);
|
|
||||||
expect(spy).toHaveBeenCalledTimes(3);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('addRepo : groupe ou repo inexistant → 404', () => {
|
|
||||||
const g = gm.createGroup({ label: 'A' });
|
|
||||||
expect(() => gm.addRepo('nope', 'repo-a')).toThrow(expect.objectContaining({ statusCode: 404, code: 'NOT_FOUND' }));
|
|
||||||
expect(() => gm.addRepo(g.id, 'nope')).toThrow(expect.objectContaining({ statusCode: 404, code: 'REPO_NOT_FOUND' }));
|
|
||||||
});
|
|
||||||
|
|
||||||
it('removeRepo : idempotent (retrait d’un repo absent = no-op)', () => {
|
|
||||||
const g = gm.createGroup({ label: 'A', repoIds: ['repo-a'] });
|
|
||||||
expect(gm.removeRepo(g.id, 'repo-a').repoIds).toEqual([]);
|
|
||||||
expect(gm.removeRepo(g.id, 'repo-a').repoIds).toEqual([]); // déjà absent → succès
|
|
||||||
});
|
|
||||||
|
|
||||||
it('deleteGroup : true + group_removed ; id inconnu → false', () => {
|
|
||||||
const g = gm.createGroup({ label: 'A' });
|
|
||||||
const spy = vi.fn();
|
|
||||||
gm.on('group_removed', spy);
|
|
||||||
expect(gm.deleteGroup(g.id)).toBe(true);
|
|
||||||
expect(spy).toHaveBeenCalledWith(g.id);
|
|
||||||
expect(gm.deleteGroup(g.id)).toBe(false);
|
|
||||||
expect(gm.listGroups()).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('CASCADE : supprimer un repo purge la membership (PRAGMA foreign_keys = ON)', () => {
|
|
||||||
const g = gm.createGroup({ label: 'A', repoIds: ['repo-a', 'repo-b'] });
|
|
||||||
expect(gm.getGroup(g.id).repoIds).toEqual(['repo-a', 'repo-b']);
|
|
||||||
db.prepare('DELETE FROM repos WHERE id = ?').run('repo-a');
|
|
||||||
expect(gm.getGroup(g.id).repoIds).toEqual(['repo-b']);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
import { describe, expect, it, afterEach } from 'vitest';
|
|
||||||
import { mkdtempSync, mkdirSync, rmSync, symlinkSync } from 'node:fs';
|
|
||||||
import { tmpdir } from 'node:os';
|
|
||||||
import { join } from 'node:path';
|
|
||||||
import { scanForRepos } from '../src/core/repo-scanner.js';
|
|
||||||
|
|
||||||
const dirs: string[] = [];
|
|
||||||
afterEach(() => {
|
|
||||||
for (const d of dirs.splice(0)) rmSync(d, { recursive: true, force: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
function tmpRoot(): string {
|
|
||||||
const d = mkdtempSync(join(tmpdir(), 'arb-scan-'));
|
|
||||||
dirs.push(d);
|
|
||||||
return d;
|
|
||||||
}
|
|
||||||
// un « repo » pour le scanner = un dossier contenant `.git` (le scanner ne lance jamais git).
|
|
||||||
function makeRepo(...segs: string[]): void {
|
|
||||||
mkdirSync(join(...segs, '.git'), { recursive: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
const limits = { maxDepth: 6, maxRepos: 2000 };
|
|
||||||
|
|
||||||
describe('scanForRepos', () => {
|
|
||||||
it('trouve un repo simple', async () => {
|
|
||||||
const root = tmpRoot();
|
|
||||||
makeRepo(root, 'proj');
|
|
||||||
const { paths, truncated } = await scanForRepos([root], limits);
|
|
||||||
expect(paths).toEqual([join(root, 'proj')]);
|
|
||||||
expect(truncated).toBe(false);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('ne descend pas dans un repo trouvé (sous-repo ignoré)', async () => {
|
|
||||||
const root = tmpRoot();
|
|
||||||
makeRepo(root, 'a');
|
|
||||||
makeRepo(root, 'a', 'sub'); // imbriqué : doit être ignoré
|
|
||||||
const { paths } = await scanForRepos([root], limits);
|
|
||||||
expect(paths).toEqual([join(root, 'a')]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('ignore node_modules et les dotdirs', async () => {
|
|
||||||
const root = tmpRoot();
|
|
||||||
makeRepo(root, 'node_modules', 'pkg');
|
|
||||||
makeRepo(root, '.hidden', 'x');
|
|
||||||
makeRepo(root, 'real');
|
|
||||||
const { paths } = await scanForRepos([root], limits);
|
|
||||||
expect(paths).toEqual([join(root, 'real')]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('respecte maxDepth', async () => {
|
|
||||||
const root = tmpRoot();
|
|
||||||
makeRepo(root, 'a', 'b', 'c', 'deep'); // repo à profondeur 4
|
|
||||||
const shallow = await scanForRepos([root], { maxDepth: 2, maxRepos: 2000 });
|
|
||||||
expect(shallow.paths).toEqual([]);
|
|
||||||
const deep = await scanForRepos([root], { maxDepth: 4, maxRepos: 2000 });
|
|
||||||
expect(deep.paths).toEqual([join(root, 'a', 'b', 'c', 'deep')]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('ne suit pas les symlinks (cycle terminé, pas de doublon)', async () => {
|
|
||||||
const root = tmpRoot();
|
|
||||||
makeRepo(root, 'proj');
|
|
||||||
try {
|
|
||||||
symlinkSync(root, join(root, 'loop')); // cycle vers la racine
|
|
||||||
} catch {
|
|
||||||
/* symlink non autorisé sous certains CI : le test reste valide sans le lien */
|
|
||||||
}
|
|
||||||
const { paths } = await scanForRepos([root], limits);
|
|
||||||
expect(paths).toEqual([join(root, 'proj')]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('tronque à maxRepos', async () => {
|
|
||||||
const root = tmpRoot();
|
|
||||||
makeRepo(root, 'r1');
|
|
||||||
makeRepo(root, 'r2');
|
|
||||||
makeRepo(root, 'r3');
|
|
||||||
const { paths, truncated } = await scanForRepos([root], { maxDepth: 6, maxRepos: 2 });
|
|
||||||
expect(truncated).toBe(true);
|
|
||||||
expect(paths.length).toBeLessThanOrEqual(2);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('ignore une racine inexistante sans lever', async () => {
|
|
||||||
const { paths } = await scanForRepos(['/nope/does/not/exist'], limits);
|
|
||||||
expect(paths).toEqual([]);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('scanne plusieurs racines', async () => {
|
|
||||||
const r1 = tmpRoot();
|
|
||||||
const r2 = tmpRoot();
|
|
||||||
makeRepo(r1, 'one');
|
|
||||||
makeRepo(r2, 'two');
|
|
||||||
const { paths } = await scanForRepos([r1, r2], limits);
|
|
||||||
expect([...paths].sort()).toEqual([join(r1, 'one'), join(r2, 'two')].sort());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,163 +0,0 @@
|
|||||||
// Routes Réglages : GET expose la config non sensible (jamais les secrets), PATCH n'écrit que
|
|
||||||
// l'allow-list et valide l'URL Gitea (http/https only, anti-XSS).
|
|
||||||
import { mkdtempSync, rmSync } from 'node:fs';
|
|
||||||
import { tmpdir } from 'node:os';
|
|
||||||
import { join } from 'node:path';
|
|
||||||
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
|
|
||||||
import { buildApp, type AppBundle } from '../src/app.js';
|
|
||||||
import { getSetting, openDb, type Db } from '../src/db/index.js';
|
|
||||||
import type { Config } from '../src/config.js';
|
|
||||||
import type { SettingsResponse } from '@arboretum/shared';
|
|
||||||
|
|
||||||
vi.mock('node:child_process', () => ({ execFileSync: () => '/usr/bin/claude\n' }));
|
|
||||||
vi.mock('@homebridge/node-pty-prebuilt-multiarch', () => {
|
|
||||||
class FakePty {
|
|
||||||
pid = 424242;
|
|
||||||
write = vi.fn();
|
|
||||||
resize = vi.fn();
|
|
||||||
pause = vi.fn();
|
|
||||||
resume = vi.fn();
|
|
||||||
kill = vi.fn();
|
|
||||||
onData(): { dispose: () => void } {
|
|
||||||
return { dispose: () => {} };
|
|
||||||
}
|
|
||||||
onExit(): { dispose: () => void } {
|
|
||||||
return { dispose: () => {} };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return { default: { spawn: (): FakePty => new FakePty() } };
|
|
||||||
});
|
|
||||||
|
|
||||||
process.env.ARBORETUM_LOG = 'silent';
|
|
||||||
|
|
||||||
let dir: string;
|
|
||||||
let bundle: AppBundle;
|
|
||||||
let db: Db;
|
|
||||||
let token: string;
|
|
||||||
|
|
||||||
const auth = (): { authorization: string } => ({ authorization: `Bearer ${token}` });
|
|
||||||
|
|
||||||
beforeAll(() => {
|
|
||||||
dir = mkdtempSync(join(tmpdir(), 'arboretum-settings-'));
|
|
||||||
const dbPath = join(dir, 'settings.db');
|
|
||||||
db = openDb(dbPath);
|
|
||||||
const config: Config = {
|
|
||||||
port: 9999,
|
|
||||||
bind: '127.0.0.1',
|
|
||||||
dbPath,
|
|
||||||
dataDir: dir,
|
|
||||||
allowedOrigins: ['https://host.tailnet.ts.net'],
|
|
||||||
printToken: false,
|
|
||||||
claudeProjectsDir: join(dir, 'claude', 'projects'),
|
|
||||||
claudeSessionsDir: join(dir, 'claude', 'sessions'),
|
|
||||||
vapidContact: 'mailto:test@localhost',
|
|
||||||
};
|
|
||||||
bundle = buildApp(config, db, '1.2.3-test');
|
|
||||||
const t = bundle.auth.ensureBootstrapToken();
|
|
||||||
if (!t) throw new Error('bootstrap token attendu');
|
|
||||||
token = t;
|
|
||||||
});
|
|
||||||
|
|
||||||
afterAll(async () => {
|
|
||||||
await bundle.app.close();
|
|
||||||
db.close();
|
|
||||||
rmSync(dir, { recursive: true, force: true });
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('GET /api/v1/settings', () => {
|
|
||||||
it('renvoie la config serveur non sensible et giteaUrl null par défaut', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/settings', headers: auth() });
|
|
||||||
expect(res.statusCode).toBe(200);
|
|
||||||
const body = res.json() as SettingsResponse;
|
|
||||||
expect(body.server.version).toBe('1.2.3-test');
|
|
||||||
expect(body.server.port).toBe(9999);
|
|
||||||
expect(body.server.bind).toBe('127.0.0.1');
|
|
||||||
expect(body.server.allowedOrigins).toEqual(['https://host.tailnet.ts.net']);
|
|
||||||
expect(body.server.vapidPublicKey).toBeTruthy(); // clé publique = sûre à exposer
|
|
||||||
expect(body.settings.giteaUrl).toBeNull();
|
|
||||||
// défauts de découverte : home (1 racine) + intervalle 5 min
|
|
||||||
expect(Array.isArray(body.settings.scanRoots)).toBe(true);
|
|
||||||
expect(body.settings.scanRoots).toHaveLength(1);
|
|
||||||
expect(body.settings.scanIntervalMin).toBe(5);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('n’expose AUCUN secret (server_secret, clé privée VAPID)', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/settings', headers: auth() });
|
|
||||||
const raw = res.body;
|
|
||||||
const secret = getSetting(db, 'server_secret');
|
|
||||||
const vapidPrivate = getSetting(db, 'vapid_private');
|
|
||||||
expect(secret).toBeTruthy();
|
|
||||||
expect(raw).not.toContain(secret as string);
|
|
||||||
expect(raw).not.toContain(vapidPrivate as string);
|
|
||||||
expect(raw).not.toMatch(/server_secret|vapid_private|privateKey/);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('PATCH /api/v1/settings', () => {
|
|
||||||
it('enregistre une URL Gitea valide et la renvoie', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'PATCH', url: '/api/v1/settings', headers: auth(), payload: { giteaUrl: 'https://git.lidge.fr' } });
|
|
||||||
expect(res.statusCode).toBe(200);
|
|
||||||
expect((res.json() as SettingsResponse).settings.giteaUrl).toBe('https://git.lidge.fr/');
|
|
||||||
// persisté
|
|
||||||
const get = await bundle.app.inject({ method: 'GET', url: '/api/v1/settings', headers: auth() });
|
|
||||||
expect((get.json() as SettingsResponse).settings.giteaUrl).toBe('https://git.lidge.fr/');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('efface l’URL avec null ou chaîne vide', async () => {
|
|
||||||
await bundle.app.inject({ method: 'PATCH', url: '/api/v1/settings', headers: auth(), payload: { giteaUrl: 'https://git.lidge.fr' } });
|
|
||||||
const res = await bundle.app.inject({ method: 'PATCH', url: '/api/v1/settings', headers: auth(), payload: { giteaUrl: null } });
|
|
||||||
expect((res.json() as SettingsResponse).settings.giteaUrl).toBeNull();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('rejette une URL non http(s) — anti-XSS (400)', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'PATCH', url: '/api/v1/settings', headers: auth(), payload: { giteaUrl: 'javascript:alert(1)' } });
|
|
||||||
expect(res.statusCode).toBe(400);
|
|
||||||
const notUrl = await bundle.app.inject({ method: 'PATCH', url: '/api/v1/settings', headers: auth(), payload: { giteaUrl: 'pas une url' } });
|
|
||||||
expect(notUrl.statusCode).toBe(400);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('ignore toute clé hors allow-list (ne touche pas aux secrets)', async () => {
|
|
||||||
const before = getSetting(db, 'server_secret');
|
|
||||||
await bundle.app.inject({ method: 'PATCH', url: '/api/v1/settings', headers: auth(), payload: { server_secret: 'pwned', vapid_private: 'pwned' } });
|
|
||||||
expect(getSetting(db, 'server_secret')).toBe(before); // inchangé
|
|
||||||
expect(getSetting(db, 'vapid_private')).not.toBe('pwned');
|
|
||||||
});
|
|
||||||
|
|
||||||
it('sans authentification → 401', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'PATCH', url: '/api/v1/settings', payload: { giteaUrl: 'https://x.example' } });
|
|
||||||
expect(res.statusCode).toBe(401);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('PATCH /api/v1/settings — découverte des dépôts', () => {
|
|
||||||
it('enregistre des scanRoots et un intervalle valides et les renvoie', async () => {
|
|
||||||
const res = await bundle.app.inject({
|
|
||||||
method: 'PATCH',
|
|
||||||
url: '/api/v1/settings',
|
|
||||||
headers: auth(),
|
|
||||||
payload: { scanRoots: ['/home/u/work', '/srv/code'], scanIntervalMin: 10 },
|
|
||||||
});
|
|
||||||
expect(res.statusCode).toBe(200);
|
|
||||||
const body = res.json() as SettingsResponse;
|
|
||||||
expect(body.settings.scanRoots).toEqual(['/home/u/work', '/srv/code']);
|
|
||||||
expect(body.settings.scanIntervalMin).toBe(10);
|
|
||||||
// persisté
|
|
||||||
const get = await bundle.app.inject({ method: 'GET', url: '/api/v1/settings', headers: auth() });
|
|
||||||
expect((get.json() as SettingsResponse).settings.scanRoots).toEqual(['/home/u/work', '/srv/code']);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('rejette des racines non absolues, "/", avec ".." ou en surnombre (400)', async () => {
|
|
||||||
const bads: unknown[] = [['relative/path'], ['/'], ['/a/../b'], Array.from({ length: 17 }, (_, i) => `/r${i}`)];
|
|
||||||
for (const scanRoots of bads) {
|
|
||||||
const res = await bundle.app.inject({ method: 'PATCH', url: '/api/v1/settings', headers: auth(), payload: { scanRoots } });
|
|
||||||
expect(res.statusCode).toBe(400);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('rejette un intervalle hors borne (400)', async () => {
|
|
||||||
const res = await bundle.app.inject({ method: 'PATCH', url: '/api/v1/settings', headers: auth(), payload: { scanIntervalMin: 5000 } });
|
|
||||||
expect(res.statusCode).toBe(400);
|
|
||||||
const neg = await bundle.app.inject({ method: 'PATCH', url: '/api/v1/settings', headers: auth(), payload: { scanIntervalMin: -1 } });
|
|
||||||
expect(neg.statusCode).toBe(400);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
import { describe, expect, it, beforeEach, afterEach, vi } from 'vitest';
|
||||||
import { execFileSync } from 'node:child_process';
|
import { execFileSync } from 'node:child_process';
|
||||||
import { mkdtempSync, mkdirSync, writeFileSync, rmSync, existsSync } from 'node:fs';
|
import { mkdtempSync, writeFileSync, rmSync, existsSync } from 'node:fs';
|
||||||
import { tmpdir } from 'node:os';
|
import { tmpdir } from 'node:os';
|
||||||
import { join, basename, dirname, resolve } from 'node:path';
|
import { join, basename, dirname, resolve } from 'node:path';
|
||||||
import type { RepoSummary, WorktreeSummary } from '@arboretum/shared';
|
import type { WorktreeSummary } from '@arboretum/shared';
|
||||||
import { WorktreeManager } from '../src/core/worktree-manager.js';
|
import { WorktreeManager } from '../src/core/worktree-manager.js';
|
||||||
import { PtyManager } from '../src/core/pty-manager.js';
|
import { PtyManager } from '../src/core/pty-manager.js';
|
||||||
import { DiscoveryService } from '../src/core/discovery-service.js';
|
import { DiscoveryService } from '../src/core/discovery-service.js';
|
||||||
@@ -34,7 +34,9 @@ afterEach(() => {
|
|||||||
for (const d of dirs.splice(0)) rmSync(d, { recursive: true, force: true });
|
for (const d of dirs.splice(0)) rmSync(d, { recursive: true, force: true });
|
||||||
});
|
});
|
||||||
|
|
||||||
function gitInit(dir: string): void {
|
function makeTmpRepo(): string {
|
||||||
|
const dir = mkdtempSync(join(tmpdir(), 'arb-wtm-'));
|
||||||
|
dirs.push(dir);
|
||||||
const run = (...args: string[]): void => void execFileSync('git', args, { cwd: dir, stdio: 'pipe' });
|
const run = (...args: string[]): void => void execFileSync('git', args, { cwd: dir, stdio: 'pipe' });
|
||||||
run('init', '-b', 'main');
|
run('init', '-b', 'main');
|
||||||
run('config', 'user.email', 'test@arboretum.dev');
|
run('config', 'user.email', 'test@arboretum.dev');
|
||||||
@@ -42,21 +44,9 @@ function gitInit(dir: string): void {
|
|||||||
writeFileSync(join(dir, 'README.md'), '# test\n');
|
writeFileSync(join(dir, 'README.md'), '# test\n');
|
||||||
run('add', '-A');
|
run('add', '-A');
|
||||||
run('commit', '-m', 'init');
|
run('commit', '-m', 'init');
|
||||||
}
|
|
||||||
|
|
||||||
function makeTmpRepo(): string {
|
|
||||||
const dir = mkdtempSync(join(tmpdir(), 'arb-wtm-'));
|
|
||||||
dirs.push(dir);
|
|
||||||
gitInit(dir);
|
|
||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Crée un vrai repo git à un chemin donné (sous une racine de scan contrôlée). */
|
|
||||||
function makeRepoAt(path: string): void {
|
|
||||||
mkdirSync(path, { recursive: true });
|
|
||||||
gitInit(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('WorktreeManager', () => {
|
describe('WorktreeManager', () => {
|
||||||
let db: Db;
|
let db: Db;
|
||||||
let pty: PtyManager;
|
let pty: PtyManager;
|
||||||
@@ -154,79 +144,4 @@ describe('WorktreeManager', () => {
|
|||||||
pty.spawn({ cwd: wtPath, command: 'bash' });
|
pty.spawn({ cwd: wtPath, command: 'bash' });
|
||||||
await expect(wt.deleteWorktree(r.id, wtPath, false)).rejects.toMatchObject({ statusCode: 409, code: 'SESSION_LIVE_IN_WORKTREE' });
|
await expect(wt.deleteWorktree(r.id, wtPath, false)).rejects.toMatchObject({ statusCode: 409, code: 'SESSION_LIVE_IN_WORKTREE' });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('addRepo renvoie hidden:false ; updateRepo({hidden}) bascule et émet repo_update', async () => {
|
|
||||||
const repo = makeTmpRepo();
|
|
||||||
const r = await wt.addRepo({ path: repo });
|
|
||||||
expect(r.hidden).toBe(false);
|
|
||||||
const updates: RepoSummary[] = [];
|
|
||||||
wt.on('repo_update', (s) => updates.push(s));
|
|
||||||
const u = await wt.updateRepo(r.id, { hidden: true });
|
|
||||||
expect(u.hidden).toBe(true);
|
|
||||||
expect(updates.some((s) => s.id === r.id && s.hidden)).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('listAllWorktrees exclut les repos masqués', async () => {
|
|
||||||
const repo = makeTmpRepo();
|
|
||||||
const r = await wt.addRepo({ path: repo });
|
|
||||||
expect((await wt.listAllWorktrees()).length).toBeGreaterThan(0); // main worktree présent
|
|
||||||
await wt.updateRepo(r.id, { hidden: true });
|
|
||||||
expect(await wt.listAllWorktrees()).toHaveLength(0);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('discoverRepos : auto-ajoute les nouveaux, idempotent, masqué non ressuscité, supprimé re-découvrable', async () => {
|
|
||||||
const root = mkdtempSync(join(tmpdir(), 'arb-scan-'));
|
|
||||||
dirs.push(root);
|
|
||||||
makeRepoAt(join(root, 'a'));
|
|
||||||
makeRepoAt(join(root, 'b'));
|
|
||||||
|
|
||||||
const updates: RepoSummary[] = [];
|
|
||||||
wt.on('repo_update', (s) => updates.push(s));
|
|
||||||
|
|
||||||
const res = await wt.discoverRepos({ roots: [root], maxDepth: 2 });
|
|
||||||
expect(res.added).toBe(2);
|
|
||||||
expect(res.scanned).toBe(2);
|
|
||||||
expect(await wt.listRepos()).toHaveLength(2);
|
|
||||||
expect(updates).toHaveLength(2); // un repo_update par nouveau
|
|
||||||
|
|
||||||
// re-scan : idempotent (aucun ajout, aucune émission)
|
|
||||||
updates.length = 0;
|
|
||||||
const res2 = await wt.discoverRepos({ roots: [root], maxDepth: 2 });
|
|
||||||
expect(res2.added).toBe(0);
|
|
||||||
expect(updates).toHaveLength(0);
|
|
||||||
expect(await wt.listRepos()).toHaveLength(2);
|
|
||||||
|
|
||||||
// masquer 'a' puis re-scan : reste masqué, jamais ré-ajouté (invariant central)
|
|
||||||
const repoA = (await wt.listRepos()).find((r) => resolve(r.path) === resolve(join(root, 'a')));
|
|
||||||
await wt.updateRepo(repoA!.id, { hidden: true });
|
|
||||||
updates.length = 0;
|
|
||||||
const res3 = await wt.discoverRepos({ roots: [root], maxDepth: 2 });
|
|
||||||
expect(res3.added).toBe(0);
|
|
||||||
expect((await wt.listRepos()).find((r) => r.id === repoA!.id)?.hidden).toBe(true);
|
|
||||||
|
|
||||||
// supprimer 'b' puis re-scan : re-découvert (volontaire)
|
|
||||||
const repoB = (await wt.listRepos()).find((r) => resolve(r.path) === resolve(join(root, 'b')));
|
|
||||||
wt.removeRepo(repoB!.id);
|
|
||||||
expect(await wt.listRepos()).toHaveLength(1);
|
|
||||||
const res4 = await wt.discoverRepos({ roots: [root], maxDepth: 2 });
|
|
||||||
expect(res4.added).toBe(1);
|
|
||||||
expect(await wt.listRepos()).toHaveLength(2);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('discoverRepos : repo disparu du disque conservé en DB (valid=false), non re-trouvé', async () => {
|
|
||||||
const root = mkdtempSync(join(tmpdir(), 'arb-scan-'));
|
|
||||||
dirs.push(root);
|
|
||||||
makeRepoAt(join(root, 'gone'));
|
|
||||||
await wt.discoverRepos({ roots: [root], maxDepth: 2 });
|
|
||||||
expect(await wt.listRepos()).toHaveLength(1);
|
|
||||||
|
|
||||||
rmSync(join(root, 'gone'), { recursive: true, force: true }); // disparaît du disque
|
|
||||||
const res = await wt.discoverRepos({ roots: [root], maxDepth: 2 });
|
|
||||||
expect(res.added).toBe(0); // plus trouvé par le scan
|
|
||||||
const repos = await wt.listRepos();
|
|
||||||
expect(repos).toHaveLength(1); // mais la ligne est conservée (pas de suppression auto)
|
|
||||||
expect(repos[0].valid).toBe(false);
|
|
||||||
// robustesse : un repo dont le chemin a disparu ne fait pas planter /worktrees (git échoue → [])
|
|
||||||
await expect(wt.listAllWorktrees()).resolves.toEqual([]);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
// Types REST partagés (préfixe /api/v1).
|
// Types REST partagés (préfixe /api/v1).
|
||||||
import type { GroupSummary, PostCreateHook, RepoSummary, SessionSummary, WorktreeSummary } from './protocol.js';
|
import type { PostCreateHook, RepoSummary, SessionSummary, WorktreeSummary } from './protocol.js';
|
||||||
|
|
||||||
export interface ApiError {
|
export interface ApiError {
|
||||||
error: { code: string; message: string; details?: unknown };
|
error: { code: string; message: string; details?: unknown };
|
||||||
@@ -14,34 +14,10 @@ export interface LoginResponse {
|
|||||||
}
|
}
|
||||||
export interface MeResponse {
|
export interface MeResponse {
|
||||||
ok: true;
|
ok: true;
|
||||||
/** id du token de la session courante — sert à marquer « courant » dans la liste des tokens. */
|
|
||||||
tokenId: string;
|
|
||||||
tokenLabel: string;
|
tokenLabel: string;
|
||||||
serverVersion: string;
|
serverVersion: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Gestion des tokens d'accès (onglet Réglages) ----
|
|
||||||
export interface TokenInfo {
|
|
||||||
id: string;
|
|
||||||
label: string;
|
|
||||||
createdAt: string;
|
|
||||||
lastUsedAt: string | null;
|
|
||||||
/** true pour le token de la session courante. */
|
|
||||||
current: boolean;
|
|
||||||
}
|
|
||||||
export interface TokensListResponse {
|
|
||||||
tokens: TokenInfo[];
|
|
||||||
}
|
|
||||||
export interface CreateTokenRequest {
|
|
||||||
label: string;
|
|
||||||
}
|
|
||||||
export interface CreateTokenResponse {
|
|
||||||
id: string;
|
|
||||||
label: string;
|
|
||||||
/** valeur en clair — affichée une seule fois, jamais re-récupérable. */
|
|
||||||
token: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CreateSessionRequest {
|
export interface CreateSessionRequest {
|
||||||
cwd: string;
|
cwd: string;
|
||||||
/** binaire à lancer — défaut "claude" ; "bash" sert aux tests d'acceptation sans quota */
|
/** binaire à lancer — défaut "claude" ; "bash" sert aux tests d'acceptation sans quota */
|
||||||
@@ -76,19 +52,6 @@ export interface UpdateRepoRequest {
|
|||||||
label?: string;
|
label?: string;
|
||||||
postCreateHooks?: PostCreateHook[];
|
postCreateHooks?: PostCreateHook[];
|
||||||
preTrust?: boolean;
|
preTrust?: boolean;
|
||||||
/** true = masquer le repo (exclu du dashboard, conservé en DB) ; false = ré-afficher. */
|
|
||||||
hidden?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Résultat d'un scan de découverte (POST /api/v1/repos/discover). */
|
|
||||||
export interface DiscoverReposResponse {
|
|
||||||
/** dossiers-repos trouvés sur disque. */
|
|
||||||
scanned: number;
|
|
||||||
/** repos réellement insérés (nouveaux, non déjà enregistrés). */
|
|
||||||
added: number;
|
|
||||||
durationMs: number;
|
|
||||||
/** true si la limite (maxRepos / timeout) a été atteinte avant la fin du scan. */
|
|
||||||
truncated: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorktreesListResponse {
|
export interface WorktreesListResponse {
|
||||||
@@ -128,49 +91,6 @@ export interface AdoptWorktreeRequest {
|
|||||||
preTrust?: boolean;
|
preTrust?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Groupes de travail (P5) ----
|
|
||||||
export interface GroupsListResponse {
|
|
||||||
groups: GroupSummary[];
|
|
||||||
}
|
|
||||||
export interface GroupResponse {
|
|
||||||
group: GroupSummary;
|
|
||||||
}
|
|
||||||
export interface CreateGroupRequest {
|
|
||||||
label: string;
|
|
||||||
description?: string;
|
|
||||||
color?: string;
|
|
||||||
/** ids de repos initiaux (défaut : []). */
|
|
||||||
repoIds?: string[];
|
|
||||||
}
|
|
||||||
export interface UpdateGroupRequest {
|
|
||||||
label?: string;
|
|
||||||
/** null pour effacer. */
|
|
||||||
description?: string | null;
|
|
||||||
color?: string | null;
|
|
||||||
}
|
|
||||||
export interface AddRepoRequest {
|
|
||||||
repoId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- Navigateur de répertoires (sélecteur de dossier côté web) ----
|
|
||||||
export interface FsEntry {
|
|
||||||
name: string;
|
|
||||||
/** chemin absolu du dossier */
|
|
||||||
path: string;
|
|
||||||
/** présent (true) uniquement en mode markRepos quand le dossier est un dépôt git */
|
|
||||||
isRepo?: boolean;
|
|
||||||
}
|
|
||||||
export interface FsListResponse {
|
|
||||||
/** chemin absolu listé (normalisé) */
|
|
||||||
path: string;
|
|
||||||
/** parent (null à la racine `/`) — pour le bouton « remonter » */
|
|
||||||
parent: string | null;
|
|
||||||
/** home de l'utilisateur côté serveur — point de départ par défaut */
|
|
||||||
home: string;
|
|
||||||
/** sous-dossiers uniquement, triés sans tenir compte de la casse */
|
|
||||||
entries: FsEntry[];
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- Web Push (P4) ----
|
// ---- Web Push (P4) ----
|
||||||
export interface VapidKeyResponse {
|
export interface VapidKeyResponse {
|
||||||
/** clé publique VAPID (applicationServerKey côté navigateur). */
|
/** clé publique VAPID (applicationServerKey côté navigateur). */
|
||||||
@@ -183,35 +103,3 @@ export interface PushSubscribeRequest {
|
|||||||
export interface PushUnsubscribeRequest {
|
export interface PushUnsubscribeRequest {
|
||||||
endpoint: string;
|
endpoint: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Réglages & info serveur (onglet Réglages) ----
|
|
||||||
/** Config runtime non sensible du daemon — lecture seule (changée via flags CLI + redémarrage). */
|
|
||||||
export interface ServerInfo {
|
|
||||||
version: string;
|
|
||||||
port: number;
|
|
||||||
bind: string;
|
|
||||||
allowedOrigins: string[];
|
|
||||||
dataDir: string;
|
|
||||||
/** clé publique VAPID (sûre à exposer) ; null si push indisponible. */
|
|
||||||
vapidPublicKey: string | null;
|
|
||||||
vapidContact: string;
|
|
||||||
}
|
|
||||||
export interface SettingsResponse {
|
|
||||||
/** réglages modifiables à chaud (allow-list serveur — jamais les secrets). */
|
|
||||||
settings: {
|
|
||||||
giteaUrl: string | null;
|
|
||||||
/** racines absolues scannées pour la découverte auto des repos (défaut : home). */
|
|
||||||
scanRoots: string[];
|
|
||||||
/** intervalle du re-scan périodique en minutes ; 0 = périodique désactivé. */
|
|
||||||
scanIntervalMin: number;
|
|
||||||
};
|
|
||||||
server: ServerInfo;
|
|
||||||
}
|
|
||||||
export interface UpdateSettingsRequest {
|
|
||||||
/** URL de l'instance Gitea (http/https) ; null ou '' pour effacer. */
|
|
||||||
giteaUrl?: string | null;
|
|
||||||
/** racines absolues à scanner (chemins normalisés, ≤ 16) ; remplace la liste. */
|
|
||||||
scanRoots?: string[];
|
|
||||||
/** intervalle du re-scan périodique en minutes (0–1440 ; 0 désactive). */
|
|
||||||
scanIntervalMin?: number;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -136,8 +136,6 @@ export interface RepoSummary {
|
|||||||
createdAt: string;
|
createdAt: string;
|
||||||
/** false si le chemin n'est plus un repo git accessible. */
|
/** false si le chemin n'est plus un repo git accessible. */
|
||||||
valid: boolean;
|
valid: boolean;
|
||||||
/** true = masqué du dashboard (conservé en DB → non ré-ajouté au re-scan). */
|
|
||||||
hidden: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WorktreeGitStatus {
|
export interface WorktreeGitStatus {
|
||||||
@@ -162,22 +160,6 @@ export interface WorktreeSummary {
|
|||||||
sessions: SessionSummary[];
|
sessions: SessionSummary[];
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Groupes de travail (P5) ----
|
|
||||||
// Un groupe regroupe plusieurs repos pour piloter des sessions Claude en simultané sur
|
|
||||||
// plusieurs worktrees. Membership légère : seule la liste d'ids de repos est persistée ;
|
|
||||||
// les repos/worktrees/sessions du groupe sont dérivés par filtrage sur `repoId` côté client.
|
|
||||||
export interface GroupSummary {
|
|
||||||
id: string;
|
|
||||||
label: string;
|
|
||||||
description: string | null;
|
|
||||||
/** couleur d'accent UI (hex `#rrggbb`) ou null. */
|
|
||||||
color: string | null;
|
|
||||||
/** ids de repos membres, ordonnés par leur position dans le groupe. */
|
|
||||||
repoIds: string[];
|
|
||||||
createdAt: string;
|
|
||||||
updatedAt: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- Messages client → serveur ----
|
// ---- Messages client → serveur ----
|
||||||
export type ClientMessage =
|
export type ClientMessage =
|
||||||
| { type: 'hello'; protocol: number }
|
| { type: 'hello'; protocol: number }
|
||||||
@@ -190,7 +172,7 @@ export type ClientMessage =
|
|||||||
| { type: 'answer'; channel: number; action: 'select' | 'confirm' | 'deny'; optionN?: number }
|
| { type: 'answer'; channel: number; action: 'select' | 'confirm' | 'deny'; optionN?: number }
|
||||||
| { type: 'resize'; channel: number; cols: number; rows: number }
|
| { type: 'resize'; channel: number; cols: number; rows: number }
|
||||||
| { type: 'ack'; channel: number; bytes: number }
|
| { type: 'ack'; channel: number; bytes: number }
|
||||||
| { type: 'sub'; topics: Array<'sessions' | 'worktrees' | 'groups'> }
|
| { type: 'sub'; topics: Array<'sessions' | 'worktrees'> }
|
||||||
| { type: 'ping' };
|
| { type: 'ping' };
|
||||||
|
|
||||||
// ---- Messages serveur → client ----
|
// ---- Messages serveur → client ----
|
||||||
@@ -205,8 +187,6 @@ export type ServerMessage =
|
|||||||
| { type: 'repo_removed'; repoId: string }
|
| { type: 'repo_removed'; repoId: string }
|
||||||
| { type: 'worktree_update'; repoId: string; worktree: WorktreeSummary }
|
| { type: 'worktree_update'; repoId: string; worktree: WorktreeSummary }
|
||||||
| { type: 'worktree_removed'; repoId: string; path: string }
|
| { type: 'worktree_removed'; repoId: string; path: string }
|
||||||
| { type: 'group_update'; group: GroupSummary }
|
|
||||||
| { type: 'group_removed'; groupId: string }
|
|
||||||
| { type: 'error'; code: ErrorCode; message: string; channel?: number }
|
| { type: 'error'; code: ErrorCode; message: string; channel?: number }
|
||||||
| { type: 'pong' };
|
| { type: 'pong' };
|
||||||
|
|
||||||
@@ -264,8 +244,8 @@ export function parseClientMessage(raw: string): ClientMessage | null {
|
|||||||
? { type: 'ack', channel: m.channel, bytes: m.bytes }
|
? { type: 'ack', channel: m.channel, bytes: m.bytes }
|
||||||
: null;
|
: null;
|
||||||
case 'sub':
|
case 'sub':
|
||||||
return Array.isArray(m.topics) && m.topics.every((t) => t === 'sessions' || t === 'worktrees' || t === 'groups')
|
return Array.isArray(m.topics) && m.topics.every((t) => t === 'sessions' || t === 'worktrees')
|
||||||
? { type: 'sub', topics: m.topics as Array<'sessions' | 'worktrees' | 'groups'> }
|
? { type: 'sub', topics: m.topics as Array<'sessions' | 'worktrees'> }
|
||||||
: null;
|
: null;
|
||||||
case 'ping':
|
case 'ping':
|
||||||
return { type: 'ping' };
|
return { type: 'ping' };
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ function assertInvariants(msg: ClientMessage): void {
|
|||||||
expect(msg.bytes).toBeGreaterThanOrEqual(0);
|
expect(msg.bytes).toBeGreaterThanOrEqual(0);
|
||||||
break;
|
break;
|
||||||
case 'sub':
|
case 'sub':
|
||||||
expect(msg.topics.every((t) => t === 'sessions' || t === 'worktrees' || t === 'groups')).toBe(true);
|
expect(msg.topics.every((t) => t === 'sessions')).toBe(true);
|
||||||
break;
|
break;
|
||||||
case 'ping':
|
case 'ping':
|
||||||
break;
|
break;
|
||||||
@@ -117,14 +117,9 @@ describe('parseClientMessage — cas valides', () => {
|
|||||||
expect(parseClientMessage('{"type":"ack","channel":1,"bytes":0}')).toEqual({ type: 'ack', channel: 1, bytes: 0 });
|
expect(parseClientMessage('{"type":"ack","channel":1,"bytes":0}')).toEqual({ type: 'ack', channel: 1, bytes: 0 });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('sub avec topics sessions/worktrees/groups (et tableau vide accepté)', () => {
|
it('sub avec topics sessions/worktrees (et tableau vide accepté)', () => {
|
||||||
expect(parseClientMessage('{"type":"sub","topics":["sessions"]}')).toEqual({ type: 'sub', topics: ['sessions'] });
|
expect(parseClientMessage('{"type":"sub","topics":["sessions"]}')).toEqual({ type: 'sub', topics: ['sessions'] });
|
||||||
expect(parseClientMessage('{"type":"sub","topics":["sessions","worktrees"]}')).toEqual({ type: 'sub', topics: ['sessions', 'worktrees'] });
|
expect(parseClientMessage('{"type":"sub","topics":["sessions","worktrees"]}')).toEqual({ type: 'sub', topics: ['sessions', 'worktrees'] });
|
||||||
expect(parseClientMessage('{"type":"sub","topics":["groups"]}')).toEqual({ type: 'sub', topics: ['groups'] });
|
|
||||||
expect(parseClientMessage('{"type":"sub","topics":["sessions","worktrees","groups"]}')).toEqual({
|
|
||||||
type: 'sub',
|
|
||||||
topics: ['sessions', 'worktrees', 'groups'],
|
|
||||||
});
|
|
||||||
expect(parseClientMessage('{"type":"sub","topics":[]}')).toEqual({ type: 'sub', topics: [] });
|
expect(parseClientMessage('{"type":"sub","topics":[]}')).toEqual({ type: 'sub', topics: [] });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,12 +7,11 @@
|
|||||||
<meta name="theme-color" content="#09090b" />
|
<meta name="theme-color" content="#09090b" />
|
||||||
<link rel="manifest" href="/manifest.webmanifest" />
|
<link rel="manifest" href="/manifest.webmanifest" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
||||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
|
||||||
<!-- iOS : le Web Push n'est disponible qu'en PWA installée (« Ajouter à l'écran d'accueil ») -->
|
<!-- iOS : le Web Push n'est disponible qu'en PWA installée (« Ajouter à l'écran d'accueil ») -->
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||||
<meta name="apple-mobile-web-app-title" content="Arboretum" />
|
<meta name="apple-mobile-web-app-title" content="Arboretum" />
|
||||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
<link rel="apple-touch-icon" href="/icon.svg" />
|
||||||
<title>Arboretum</title>
|
<title>Arboretum</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@arboretum/shared": "*",
|
"@arboretum/shared": "*",
|
||||||
"@lucide/vue": "^1.21.0",
|
|
||||||
"@xterm/addon-fit": "^0.11.0",
|
"@xterm/addon-fit": "^0.11.0",
|
||||||
"@xterm/addon-webgl": "^0.19.0",
|
"@xterm/addon-webgl": "^0.19.0",
|
||||||
"@xterm/xterm": "^6.0.0",
|
"@xterm/xterm": "^6.0.0",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 75 KiB |
@@ -1,46 +1,18 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" role="img" aria-label="Arboretum">
|
<svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" role="img" aria-label="Arboretum">
|
||||||
<defs>
|
|
||||||
<!-- glow néon : flou doux derrière les traits et les nœuds -->
|
|
||||||
<filter id="glow" x="-30%" y="-30%" width="160%" height="160%">
|
|
||||||
<feGaussianBlur stdDeviation="6" result="b"/>
|
|
||||||
<feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge>
|
|
||||||
</filter>
|
|
||||||
<linearGradient id="branch" x1="256" y1="430" x2="256" y2="90" gradientUnits="userSpaceOnUse">
|
|
||||||
<stop offset="0" stop-color="#10b981"/>
|
|
||||||
<stop offset="1" stop-color="#34d399"/>
|
|
||||||
</linearGradient>
|
|
||||||
</defs>
|
|
||||||
|
|
||||||
<rect width="512" height="512" fill="#09090b"/>
|
<rect width="512" height="512" fill="#09090b"/>
|
||||||
|
<!-- arbre / branches (worktrees) — tracé dans la zone sûre maskable (~80% central) -->
|
||||||
<!-- branches / circuit (tronc + fourches symétriques), tracées dans la zone sûre maskable -->
|
<g fill="none" stroke="#34d399" stroke-width="22" stroke-linecap="round" stroke-linejoin="round">
|
||||||
<g fill="none" stroke="url(#branch)" stroke-width="17" stroke-linecap="round" stroke-linejoin="round" filter="url(#glow)">
|
<!-- tronc -->
|
||||||
<!-- tronc : du nœud sommet jusqu'à la base avec le curseur >_ -->
|
<path d="M256 420 V232"/>
|
||||||
<path d="M256 96 V392"/>
|
<!-- branche gauche -->
|
||||||
<!-- paire haute -->
|
<path d="M256 300 L168 212"/>
|
||||||
<path d="M256 232 L150 232 V150"/>
|
<!-- branche droite -->
|
||||||
<path d="M256 232 L362 232 V150"/>
|
<path d="M256 268 L344 180"/>
|
||||||
<!-- paire médiane -->
|
|
||||||
<path d="M256 300 L104 300 V214"/>
|
|
||||||
<path d="M256 300 L408 300 V214"/>
|
|
||||||
<!-- paire basse -->
|
|
||||||
<path d="M256 356 L150 356 V300"/>
|
|
||||||
<path d="M256 356 L362 356 V300"/>
|
|
||||||
<!-- base : invite de commande >_ -->
|
|
||||||
<path d="M232 404 L246 418 L232 432" stroke-width="14"/>
|
|
||||||
<path d="M258 434 H286" stroke-width="14"/>
|
|
||||||
</g>
|
|
||||||
|
|
||||||
<!-- nœuds (sessions) : anneaux cyan lumineux, centre sombre -->
|
|
||||||
<g filter="url(#glow)">
|
|
||||||
<g fill="#09090b" stroke="#22d3ee" stroke-width="9">
|
|
||||||
<circle cx="256" cy="96" r="20"/>
|
|
||||||
<circle cx="150" cy="150" r="16"/>
|
|
||||||
<circle cx="362" cy="150" r="16"/>
|
|
||||||
<circle cx="104" cy="214" r="16"/>
|
|
||||||
<circle cx="408" cy="214" r="16"/>
|
|
||||||
<circle cx="150" cy="300" r="16"/>
|
|
||||||
<circle cx="362" cy="300" r="16"/>
|
|
||||||
</g>
|
</g>
|
||||||
|
<!-- nœuds (sessions) -->
|
||||||
|
<g fill="#34d399">
|
||||||
|
<circle cx="256" cy="156" r="34"/>
|
||||||
|
<circle cx="160" cy="196" r="26"/>
|
||||||
|
<circle cx="352" cy="164" r="26"/>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 727 B |
|
Before Width: | Height: | Size: 151 KiB |
@@ -8,8 +8,6 @@
|
|||||||
"background_color": "#09090b",
|
"background_color": "#09090b",
|
||||||
"theme_color": "#09090b",
|
"theme_color": "#09090b",
|
||||||
"icons": [
|
"icons": [
|
||||||
{ "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any" },
|
{ "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any maskable" }
|
||||||
{ "src": "/icon-192.png", "sizes": "192x192", "type": "image/png", "purpose": "maskable" },
|
|
||||||
{ "src": "/icon-512.png", "sizes": "512x512", "type": "image/png", "purpose": "maskable" }
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="flex h-dvh flex-col">
|
<div class="flex h-full flex-col">
|
||||||
<WsBanner v-if="wsReconnecting" />
|
<div
|
||||||
<AppShell v-if="layout !== 'bare'" :fullbleed="layout === 'fullbleed'">
|
v-if="wsReconnecting"
|
||||||
<RouterView />
|
class="border-b border-amber-900/50 bg-amber-950/80 px-4 py-1.5 text-center text-xs text-amber-300"
|
||||||
</AppShell>
|
>
|
||||||
<RouterView v-else class="min-h-0 flex-1" />
|
{{ t('ws.reconnecting') }}
|
||||||
<ToastContainer />
|
</div>
|
||||||
<CommandPalette />
|
<RouterView class="min-h-0 flex-1" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
import { useRoute } from 'vue-router';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { wsClient } from './lib/ws-client';
|
import { wsClient } from './lib/ws-client';
|
||||||
import WsBanner from './components/layout/WsBanner.vue';
|
|
||||||
import AppShell from './components/layout/AppShell.vue';
|
|
||||||
import ToastContainer from './components/ToastContainer.vue';
|
|
||||||
import CommandPalette from './components/CommandPalette.vue';
|
|
||||||
|
|
||||||
const route = useRoute();
|
const { t } = useI18n();
|
||||||
const layout = computed(() => route.meta.layout ?? 'shell');
|
|
||||||
const wsReconnecting = computed(() => wsClient.status.value === 'reconnecting');
|
const wsReconnecting = computed(() => wsClient.status.value === 'reconnecting');
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
<template>
|
|
||||||
<section v-if="waiting.length" class="flex flex-col gap-2 rounded-xl border border-amber-900/50 bg-amber-950/20 p-3">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<AlertTriangle :size="16" class="text-amber-400" />
|
|
||||||
<h2 class="text-sm font-semibold text-amber-200">{{ t('attention.title') }}</h2>
|
|
||||||
<BaseBadge tone="amber">{{ t('attention.count', waiting.length) }}</BaseBadge>
|
|
||||||
</div>
|
|
||||||
<div v-for="s in waiting" :key="s.id" class="flex flex-col gap-1">
|
|
||||||
<RouterLink
|
|
||||||
:to="{ name: 'session', params: { id: s.id } }"
|
|
||||||
class="truncate font-mono text-xs text-amber-300/80 transition-colors hover:text-amber-200"
|
|
||||||
:title="s.cwd"
|
|
||||||
>
|
|
||||||
{{ s.cwd }}
|
|
||||||
</RouterLink>
|
|
||||||
<DialogPrompt :session="s" />
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// Vue « À traiter » : regroupe en tête les sessions bloquées sur un dialogue (cœur de la
|
|
||||||
// supervision mobile). Réutilise DialogPrompt pour répondre sans ouvrir le terminal.
|
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { AlertTriangle } from '@lucide/vue';
|
|
||||||
import { useSessionsStore } from '../stores/sessions';
|
|
||||||
import DialogPrompt from './DialogPrompt.vue';
|
|
||||||
import BaseBadge from './ui/BaseBadge.vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const sessions = useSessionsStore();
|
|
||||||
|
|
||||||
const waiting = computed(() =>
|
|
||||||
sessions.sessions.filter((s) => s.live && s.activity === 'waiting' && s.dialog),
|
|
||||||
);
|
|
||||||
</script>
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
<template>
|
|
||||||
<Teleport to="body">
|
|
||||||
<div v-if="open" class="fixed inset-0 z-[60] flex items-start justify-center p-4 pt-[10vh]" role="dialog" aria-modal="true">
|
|
||||||
<div class="absolute inset-0 bg-black/60" @click="close" />
|
|
||||||
<div class="relative flex max-h-[70vh] w-full max-w-lg flex-col overflow-hidden rounded-xl border border-zinc-700 bg-zinc-900 shadow-pop">
|
|
||||||
<div class="flex items-center gap-2 border-b border-zinc-800 px-3">
|
|
||||||
<Search :size="16" class="text-zinc-500" />
|
|
||||||
<input
|
|
||||||
ref="inputEl"
|
|
||||||
v-model="query"
|
|
||||||
type="text"
|
|
||||||
class="w-full bg-transparent py-3 text-sm text-zinc-100 outline-none placeholder:text-zinc-600"
|
|
||||||
:placeholder="t('palette.placeholder')"
|
|
||||||
:aria-activedescendant="activeId ? `cmd-${activeId}` : undefined"
|
|
||||||
role="combobox"
|
|
||||||
aria-controls="cmd-listbox"
|
|
||||||
aria-expanded="true"
|
|
||||||
@keydown.down.prevent="move(1)"
|
|
||||||
@keydown.up.prevent="move(-1)"
|
|
||||||
@keydown.enter.prevent="run(results[activeIndex])"
|
|
||||||
@keydown.esc.prevent="close"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<ul v-if="results.length" id="cmd-listbox" role="listbox" class="min-h-0 flex-1 overflow-y-auto p-1.5">
|
|
||||||
<li
|
|
||||||
v-for="(item, i) in results"
|
|
||||||
:id="`cmd-${item.id}`"
|
|
||||||
:key="item.id"
|
|
||||||
role="option"
|
|
||||||
:aria-selected="i === activeIndex"
|
|
||||||
class="flex cursor-pointer items-center gap-2 rounded-lg px-2.5 py-2"
|
|
||||||
:class="i === activeIndex ? 'bg-zinc-800' : 'hover:bg-zinc-800/50'"
|
|
||||||
@mousemove="activeIndex = i"
|
|
||||||
@click="run(item)"
|
|
||||||
>
|
|
||||||
<component :is="item.icon" :size="15" class="shrink-0 text-zinc-500" />
|
|
||||||
<span class="min-w-0 flex-1">
|
|
||||||
<span class="block truncate text-sm text-zinc-100">{{ item.label }}</span>
|
|
||||||
<span v-if="item.sublabel" class="block truncate font-mono text-[11px] text-zinc-500">{{ item.sublabel }}</span>
|
|
||||||
</span>
|
|
||||||
<span class="shrink-0 text-[10px] uppercase tracking-wide text-zinc-600">{{ t(`palette.types.${item.type}`) }}</span>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
<p v-else class="px-3 py-6 text-center text-sm text-zinc-500">{{ t('palette.empty') }}</p>
|
|
||||||
|
|
||||||
<div class="border-t border-zinc-800 px-3 py-1.5 text-[11px] text-zinc-600">{{ t('palette.hint') }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Teleport>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch, type Component } from 'vue';
|
|
||||||
import { useRouter, type RouteLocationRaw } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { Search, GitBranch, TerminalSquare, Boxes, Plus, FolderPlus } from '@lucide/vue';
|
|
||||||
import { useSessionsStore } from '../stores/sessions';
|
|
||||||
import { useWorktreesStore } from '../stores/worktrees';
|
|
||||||
import { useGroupsStore } from '../stores/groups';
|
|
||||||
import { useCommandPalette } from '../composables/useCommandPalette';
|
|
||||||
|
|
||||||
interface PaletteItem {
|
|
||||||
id: string;
|
|
||||||
type: 'repo' | 'worktree' | 'session' | 'group' | 'action';
|
|
||||||
label: string;
|
|
||||||
sublabel?: string;
|
|
||||||
icon: Component;
|
|
||||||
keywords: string;
|
|
||||||
to?: RouteLocationRaw;
|
|
||||||
run?: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const router = useRouter();
|
|
||||||
const { open, close, toggle } = useCommandPalette();
|
|
||||||
const sessions = useSessionsStore();
|
|
||||||
const worktrees = useWorktreesStore();
|
|
||||||
const groups = useGroupsStore();
|
|
||||||
|
|
||||||
const query = ref('');
|
|
||||||
const activeIndex = ref(0);
|
|
||||||
const inputEl = ref<HTMLInputElement | null>(null);
|
|
||||||
|
|
||||||
const basename = (p: string): string => p.split('/').filter(Boolean).pop() ?? p;
|
|
||||||
|
|
||||||
const items = computed<PaletteItem[]>(() => {
|
|
||||||
const out: PaletteItem[] = [];
|
|
||||||
for (const r of worktrees.repos) {
|
|
||||||
out.push({ id: `repo-${r.id}`, type: 'repo', label: r.label, sublabel: r.path, icon: GitBranch as Component, keywords: `${r.label} ${r.path}`.toLowerCase(), to: { name: 'dashboard' } });
|
|
||||||
}
|
|
||||||
for (const w of worktrees.worktrees) {
|
|
||||||
const target: RouteLocationRaw = w.sessions[0]
|
|
||||||
? { name: 'session', params: { id: w.sessions[0].id } }
|
|
||||||
: { name: 'dashboard' };
|
|
||||||
out.push({ id: `wt-${w.path}`, type: 'worktree', label: w.branch ?? basename(w.path), sublabel: w.path, icon: GitBranch as Component, keywords: `${w.branch ?? ''} ${w.path}`.toLowerCase(), to: target });
|
|
||||||
}
|
|
||||||
for (const s of sessions.sessions) {
|
|
||||||
out.push({ id: `ses-${s.id}`, type: 'session', label: s.title ?? basename(s.cwd), sublabel: s.cwd, icon: TerminalSquare as Component, keywords: `${s.title ?? ''} ${s.cwd} ${s.command}`.toLowerCase(), to: { name: 'session', params: { id: s.id } } });
|
|
||||||
}
|
|
||||||
for (const g of groups.groups) {
|
|
||||||
out.push({ id: `grp-${g.id}`, type: 'group', label: g.label, ...(g.description ? { sublabel: g.description } : {}), icon: Boxes as Component, keywords: `${g.label} ${g.description ?? ''}`.toLowerCase(), to: { name: 'group', params: { id: g.id } } });
|
|
||||||
}
|
|
||||||
// actions globales
|
|
||||||
out.push({ id: 'act-newSession', type: 'action', label: t('palette.actions.newSession'), icon: Plus as Component, keywords: t('palette.actions.newSession').toLowerCase(), to: { name: 'sessions' } });
|
|
||||||
out.push({ id: 'act-addRepo', type: 'action', label: t('palette.actions.addRepo'), icon: FolderPlus as Component, keywords: t('palette.actions.addRepo').toLowerCase(), to: { name: 'dashboard' } });
|
|
||||||
out.push({ id: 'act-newGroup', type: 'action', label: t('palette.actions.newGroup'), icon: Boxes as Component, keywords: t('palette.actions.newGroup').toLowerCase(), to: { name: 'groups' } });
|
|
||||||
return out;
|
|
||||||
});
|
|
||||||
|
|
||||||
// fuzzy minimal : tous les tokens présents (AND), score = somme des positions (plus tôt = mieux).
|
|
||||||
const results = computed<PaletteItem[]>(() => {
|
|
||||||
const tokens = query.value.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
||||||
if (tokens.length === 0) return items.value.slice(0, 30);
|
|
||||||
const scored: { item: PaletteItem; score: number }[] = [];
|
|
||||||
for (const item of items.value) {
|
|
||||||
let score = 0;
|
|
||||||
let ok = true;
|
|
||||||
for (const tok of tokens) {
|
|
||||||
const idx = item.keywords.indexOf(tok);
|
|
||||||
if (idx < 0) {
|
|
||||||
ok = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
score += idx;
|
|
||||||
}
|
|
||||||
if (ok) scored.push({ item, score });
|
|
||||||
}
|
|
||||||
return scored.sort((a, b) => a.score - b.score).slice(0, 30).map((s) => s.item);
|
|
||||||
});
|
|
||||||
|
|
||||||
watch(results, () => {
|
|
||||||
if (activeIndex.value >= results.value.length) activeIndex.value = 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
const activeId = computed(() => results.value[activeIndex.value]?.id);
|
|
||||||
|
|
||||||
function move(delta: number): void {
|
|
||||||
const n = results.value.length;
|
|
||||||
if (n === 0) return;
|
|
||||||
activeIndex.value = (activeIndex.value + delta + n) % n;
|
|
||||||
}
|
|
||||||
|
|
||||||
function run(item: PaletteItem | undefined): void {
|
|
||||||
if (!item) return;
|
|
||||||
close();
|
|
||||||
if (item.run) item.run();
|
|
||||||
else if (item.to) void router.push(item.to);
|
|
||||||
}
|
|
||||||
|
|
||||||
watch(open, async (v) => {
|
|
||||||
if (v) {
|
|
||||||
query.value = '';
|
|
||||||
activeIndex.value = 0;
|
|
||||||
await nextTick();
|
|
||||||
inputEl.value?.focus();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// raccourci global ⌘K / Ctrl+K — en phase de capture pour passer devant xterm (SessionView).
|
|
||||||
function onKey(e: KeyboardEvent): void {
|
|
||||||
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') {
|
|
||||||
e.preventDefault();
|
|
||||||
toggle();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
onMounted(() => window.addEventListener('keydown', onKey, { capture: true }));
|
|
||||||
onUnmounted(() => window.removeEventListener('keydown', onKey, { capture: true }));
|
|
||||||
</script>
|
|
||||||
@@ -1,122 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4" @click.self="emit('close')">
|
|
||||||
<div class="flex max-h-[90vh] w-full max-w-lg flex-col gap-3 overflow-y-auto rounded-lg border border-zinc-800 bg-zinc-900 p-4">
|
|
||||||
<header class="flex items-center gap-2">
|
|
||||||
<h2 class="font-semibold text-zinc-100">{{ t('crossRepo.title') }}</h2>
|
|
||||||
<button class="btn ml-auto text-xs" @click="emit('close')">{{ t('crossRepo.close') }}</button>
|
|
||||||
</header>
|
|
||||||
<p class="text-xs text-zinc-500">{{ t('crossRepo.intro') }}</p>
|
|
||||||
|
|
||||||
<form class="flex flex-col gap-3" @submit.prevent="onSubmit">
|
|
||||||
<label class="flex flex-col gap-1 text-xs text-zinc-400">
|
|
||||||
{{ t('crossRepo.branchLabel') }}
|
|
||||||
<input v-model="branch" class="input font-mono" :placeholder="t('crossRepo.branchPlaceholder')" required />
|
|
||||||
</label>
|
|
||||||
<div class="flex flex-wrap items-end gap-3">
|
|
||||||
<label class="flex items-center gap-1.5 text-xs text-zinc-400">
|
|
||||||
<input v-model="newBranch" type="checkbox" /> {{ t('crossRepo.newBranch') }}
|
|
||||||
</label>
|
|
||||||
<label class="flex flex-col gap-1 text-xs text-zinc-400">
|
|
||||||
{{ t('crossRepo.baseRefLabel') }}
|
|
||||||
<input v-model="baseRef" class="input font-mono" placeholder="HEAD" />
|
|
||||||
</label>
|
|
||||||
<label class="flex flex-col gap-1 text-xs text-zinc-400">
|
|
||||||
{{ t('crossRepo.startLabel') }}
|
|
||||||
<select v-model="startSession" class="input">
|
|
||||||
<option :value="null">{{ t('crossRepo.startNone') }}</option>
|
|
||||||
<option value="claude">claude</option>
|
|
||||||
<option value="bash">bash</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex flex-col gap-1 text-xs text-zinc-400">
|
|
||||||
{{ t('crossRepo.reposLabel') }}
|
|
||||||
<div class="flex flex-col gap-1">
|
|
||||||
<label
|
|
||||||
v-for="repo in repos"
|
|
||||||
:key="repo.id"
|
|
||||||
class="flex items-center gap-2 rounded border border-zinc-800 bg-zinc-950/40 px-2 py-1"
|
|
||||||
>
|
|
||||||
<input v-model="selectedRepoIds" type="checkbox" :value="repo.id" :disabled="running" />
|
|
||||||
<span class="flex-1 text-zinc-300">{{ repo.label }}</span>
|
|
||||||
<span v-if="results[repo.id]" class="text-[11px]" :class="statusClass(repo.id)">
|
|
||||||
{{ statusText(repo.id) }}
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<button type="submit" class="btn-primary" :disabled="running || branch.trim() === '' || selectedRepoIds.length === 0">
|
|
||||||
{{ running ? t('crossRepo.creating') : t('crossRepo.create', { n: selectedRepoIds.length }) }}
|
|
||||||
</button>
|
|
||||||
<button v-if="hasFailures && !running" type="button" class="btn text-xs" @click="retryFailed">
|
|
||||||
{{ t('crossRepo.retryFailed') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed, ref } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import type { RepoSummary } from '@arboretum/shared';
|
|
||||||
import { useGroupsStore, type CrossRepoResult } from '../stores/groups';
|
|
||||||
|
|
||||||
const props = defineProps<{ repos: RepoSummary[] }>();
|
|
||||||
const emit = defineEmits<{ close: [] }>();
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const groups = useGroupsStore();
|
|
||||||
|
|
||||||
const branch = ref('');
|
|
||||||
const newBranch = ref(true);
|
|
||||||
const baseRef = ref('');
|
|
||||||
const startSession = ref<'claude' | 'bash' | null>(null);
|
|
||||||
const selectedRepoIds = ref<string[]>(props.repos.map((r) => r.id));
|
|
||||||
const results = ref<Record<string, CrossRepoResult>>({});
|
|
||||||
const running = ref(false);
|
|
||||||
|
|
||||||
const hasFailures = computed(() => Object.values(results.value).some((r) => r.status === 'error'));
|
|
||||||
|
|
||||||
function statusClass(repoId: string): string {
|
|
||||||
return results.value[repoId]?.status === 'ok' ? 'text-emerald-400' : 'text-red-400';
|
|
||||||
}
|
|
||||||
function statusText(repoId: string): string {
|
|
||||||
const r = results.value[repoId];
|
|
||||||
if (!r) return '';
|
|
||||||
return r.status === 'ok' ? t('crossRepo.ok') : `${t('crossRepo.error')}: ${r.message ?? ''}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function run(repoIds: string[]): Promise<void> {
|
|
||||||
if (repoIds.length === 0) return;
|
|
||||||
running.value = true;
|
|
||||||
for (const id of repoIds) delete results.value[id];
|
|
||||||
try {
|
|
||||||
await groups.createCrossRepoFeature(
|
|
||||||
repoIds,
|
|
||||||
{
|
|
||||||
branch: branch.value.trim(),
|
|
||||||
newBranch: newBranch.value,
|
|
||||||
...(baseRef.value.trim() ? { baseRef: baseRef.value.trim() } : {}),
|
|
||||||
startSession: startSession.value,
|
|
||||||
},
|
|
||||||
(result) => {
|
|
||||||
results.value = { ...results.value, [result.repoId]: result };
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} finally {
|
|
||||||
running.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubmit(): void {
|
|
||||||
void run([...selectedRepoIds.value]);
|
|
||||||
}
|
|
||||||
function retryFailed(): void {
|
|
||||||
void run(Object.values(results.value).filter((r) => r.status === 'error').map((r) => r.repoId));
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
<template>
|
|
||||||
<section class="flex flex-col gap-2 rounded-lg border border-zinc-800 bg-zinc-950/40 p-2">
|
|
||||||
<header class="flex items-center gap-2">
|
|
||||||
<button type="button" class="btn text-xs" :disabled="loading || parent === null" @click="load(parent ?? undefined)">
|
|
||||||
↑ {{ t('fs.up') }}
|
|
||||||
</button>
|
|
||||||
<span class="min-w-0 flex-1 truncate font-mono text-xs text-zinc-400" :title="current">{{ current }}</span>
|
|
||||||
<button type="button" class="btn text-xs" @click="emit('close')">{{ t('common.cancel') }}</button>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<p v-if="error" class="text-sm text-red-400">{{ error }}</p>
|
|
||||||
|
|
||||||
<ul class="flex max-h-60 flex-col gap-0.5 overflow-y-auto">
|
|
||||||
<li v-if="loading" class="px-2 py-1 text-xs text-zinc-500">{{ t('fs.loading') }}</li>
|
|
||||||
<li v-else-if="entries.length === 0" class="px-2 py-1 text-xs text-zinc-500">{{ t('fs.empty') }}</li>
|
|
||||||
<li v-for="e in entries" :key="e.path">
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="flex w-full items-center gap-2 rounded px-2 py-1 text-left text-sm text-zinc-200 hover:bg-zinc-800"
|
|
||||||
@click="load(e.path)"
|
|
||||||
>
|
|
||||||
<span class="flex-1 truncate font-mono">{{ e.name }}</span>
|
|
||||||
<span v-if="e.isRepo" class="badge bg-emerald-950 text-emerald-400">{{ t('fs.repoBadge') }}</span>
|
|
||||||
</button>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<footer class="flex items-center gap-2">
|
|
||||||
<label class="flex items-center gap-1 text-xs text-zinc-400">
|
|
||||||
<input v-model="showHidden" type="checkbox" @change="load(current || undefined)" /> {{ t('fs.showHidden') }}
|
|
||||||
</label>
|
|
||||||
<button type="button" class="btn-primary ml-auto text-xs" :disabled="loading || current === ''" @click="emit('select', current)">
|
|
||||||
{{ t('fs.useFolder') }}
|
|
||||||
</button>
|
|
||||||
</footer>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { onMounted, ref } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import type { FsEntry, FsListResponse } from '@arboretum/shared';
|
|
||||||
import { api } from '../lib/api';
|
|
||||||
|
|
||||||
// mode 'repo' : annote les sous-dossiers qui sont des dépôts git (badge). 'dir' : navigation simple.
|
|
||||||
const props = withDefaults(defineProps<{ mode?: 'dir' | 'repo'; initialPath?: string }>(), {
|
|
||||||
mode: 'dir',
|
|
||||||
initialPath: '',
|
|
||||||
});
|
|
||||||
const emit = defineEmits<{ select: [path: string]; close: [] }>();
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const current = ref('');
|
|
||||||
const parent = ref<string | null>(null);
|
|
||||||
const entries = ref<FsEntry[]>([]);
|
|
||||||
const loading = ref(false);
|
|
||||||
const error = ref<string | null>(null);
|
|
||||||
const showHidden = ref(false);
|
|
||||||
|
|
||||||
/** path absent → le serveur retombe sur le home. En cas d'erreur, on garde l'écoute précédente affichée. */
|
|
||||||
async function load(path?: string): Promise<void> {
|
|
||||||
loading.value = true;
|
|
||||||
error.value = null;
|
|
||||||
try {
|
|
||||||
const params = new URLSearchParams();
|
|
||||||
if (path) params.set('path', path);
|
|
||||||
if (props.mode === 'repo') params.set('markRepos', '1');
|
|
||||||
if (showHidden.value) params.set('showHidden', '1');
|
|
||||||
const res = await api.get<FsListResponse>(`/api/v1/fs/list?${params.toString()}`);
|
|
||||||
current.value = res.path;
|
|
||||||
parent.value = res.parent;
|
|
||||||
entries.value = res.entries;
|
|
||||||
} catch (err) {
|
|
||||||
error.value = err instanceof Error ? err.message : String(err);
|
|
||||||
} finally {
|
|
||||||
loading.value = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
// démarre sur le chemin déjà saisi s'il est absolu, sinon sur le home (path absent).
|
|
||||||
void load(props.initialPath.startsWith('/') ? props.initialPath : undefined);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<div class="flex flex-col gap-2 sm:flex-row sm:items-center">
|
|
||||||
<!-- recherche -->
|
|
||||||
<div class="relative flex-1">
|
|
||||||
<Search :size="15" class="pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-zinc-500" />
|
|
||||||
<input
|
|
||||||
v-model="searchModel"
|
|
||||||
type="search"
|
|
||||||
class="input pl-8"
|
|
||||||
:placeholder="t(searchPlaceholderKey ?? 'controls.searchPlaceholder')"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- tri : clé + direction -->
|
|
||||||
<div class="flex items-center gap-1.5">
|
|
||||||
<label class="sr-only" :for="sortId">{{ t('controls.sortBy') }}</label>
|
|
||||||
<select :id="sortId" class="input w-auto" :value="controls.sortKey.value" @change="onSortChange">
|
|
||||||
<option v-for="def in controls.sortDefs" :key="def.key" :value="def.key">{{ t(def.labelKey) }}</option>
|
|
||||||
</select>
|
|
||||||
<BaseButton
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
icon-only
|
|
||||||
:icon="controls.sortDir.value === 'asc' ? ArrowUp : ArrowDown"
|
|
||||||
:aria-label="t(controls.sortDir.value === 'asc' ? 'sort.asc' : 'sort.desc')"
|
|
||||||
@click="controls.setSort(controls.sortKey.value)"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- chips de filtre + compteur (le compteur s'affiche même sans filtres) -->
|
|
||||||
<div class="flex flex-wrap items-center gap-1.5">
|
|
||||||
<template v-for="def in controls.filterDefs.value" :key="def.key">
|
|
||||||
<button
|
|
||||||
v-for="opt in def.options"
|
|
||||||
:key="def.key + ':' + opt.value"
|
|
||||||
type="button"
|
|
||||||
class="rounded-full border px-2 py-0.5 text-xs transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/50"
|
|
||||||
:class="isActive(def.key, opt.value)
|
|
||||||
? 'border-sky-700 bg-sky-950/40 text-sky-300'
|
|
||||||
: 'border-zinc-700 text-zinc-400 hover:border-zinc-600 hover:text-zinc-200'"
|
|
||||||
@click="controls.toggleFilter(def.key, opt.value)"
|
|
||||||
>
|
|
||||||
{{ opt.labelKey ? t(opt.labelKey) : opt.label }}
|
|
||||||
</button>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<BaseButton
|
|
||||||
v-if="controls.activeFilterCount.value > 0 || controls.search.value"
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
:icon="X"
|
|
||||||
@click="controls.clearAll()"
|
|
||||||
>
|
|
||||||
{{ t('controls.clearAll') }}
|
|
||||||
</BaseButton>
|
|
||||||
|
|
||||||
<span class="ml-auto text-xs text-zinc-500">{{ t('controls.results', controls.total.value) }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts" generic="T">
|
|
||||||
import { computed, useId } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { Search, ArrowUp, ArrowDown, X } from '@lucide/vue';
|
|
||||||
import BaseButton from './ui/BaseButton.vue';
|
|
||||||
import type { ListToolbarControls } from '../composables/useListControls';
|
|
||||||
|
|
||||||
const props = defineProps<{ controls: ListToolbarControls<T>; searchPlaceholderKey?: string }>();
|
|
||||||
const { t } = useI18n();
|
|
||||||
const sortId = useId();
|
|
||||||
|
|
||||||
const searchModel = computed({
|
|
||||||
get: () => props.controls.search.value,
|
|
||||||
set: (v: string) => props.controls.setSearch(v),
|
|
||||||
});
|
|
||||||
|
|
||||||
function onSortChange(e: Event): void {
|
|
||||||
props.controls.setSort((e.target as HTMLSelectElement).value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function isActive(key: string, value: string): boolean {
|
|
||||||
return props.controls.filters.value[key]?.has(value) ?? false;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div v-if="pageCount > 1 || pageSize !== defaultSize" class="flex flex-wrap items-center justify-between gap-2 text-xs text-zinc-500">
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<label class="flex items-center gap-1.5">
|
|
||||||
{{ t('pagination.perPage') }}
|
|
||||||
<select class="input w-auto py-1" :value="pageSize" @change="onSize">
|
|
||||||
<option v-for="opt in pageSizeOptions" :key="opt" :value="opt">{{ opt === 0 ? t('pagination.all') : opt }}</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
<div v-if="pageCount > 1" class="flex items-center gap-2">
|
|
||||||
<BaseButton variant="ghost" size="sm" :icon="ChevronLeft" :disabled="page <= 1" @click="emit('update:page', page - 1)">
|
|
||||||
{{ t('pagination.prev') }}
|
|
||||||
</BaseButton>
|
|
||||||
<span>{{ t('pagination.pageOf', { page, pageCount }) }}</span>
|
|
||||||
<BaseButton variant="ghost" size="sm" :disabled="page >= pageCount" @click="emit('update:page', page + 1)">
|
|
||||||
{{ t('pagination.next') }}
|
|
||||||
<ChevronRight :size="15" />
|
|
||||||
</BaseButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { ChevronLeft, ChevronRight } from '@lucide/vue';
|
|
||||||
import BaseButton from './ui/BaseButton.vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
page: number;
|
|
||||||
pageCount: number;
|
|
||||||
pageSize: number;
|
|
||||||
pageSizeOptions?: number[];
|
|
||||||
defaultSize?: number;
|
|
||||||
}>(),
|
|
||||||
{ pageSizeOptions: () => [25, 50, 100, 0], defaultSize: 25 },
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{ 'update:page': [number]; 'update:pageSize': [number] }>();
|
|
||||||
|
|
||||||
function onSize(e: Event): void {
|
|
||||||
emit('update:pageSize', Number((e.target as HTMLSelectElement).value));
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,27 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="card flex flex-col gap-2">
|
<section class="flex flex-col gap-2 rounded-lg border border-zinc-800 bg-zinc-900/50 p-3">
|
||||||
<header class="flex flex-wrap items-center gap-2">
|
<header class="flex items-center gap-2">
|
||||||
<h2 class="font-semibold text-zinc-100">{{ repo.label }}</h2>
|
<h2 class="font-semibold text-zinc-100">{{ repo.label }}</h2>
|
||||||
<BaseBadge v-if="!repo.valid" tone="red">{{ t('repos.invalid') }}</BaseBadge>
|
<span v-if="!repo.valid" class="badge bg-red-950 text-red-400">{{ t('repos.invalid') }}</span>
|
||||||
<span class="truncate font-mono text-xs text-zinc-500" :title="repo.path">{{ repo.path }}</span>
|
<span class="truncate font-mono text-xs text-zinc-500" :title="repo.path">{{ repo.path }}</span>
|
||||||
<div class="ml-auto flex items-center gap-2">
|
<div class="ml-auto flex items-center gap-2">
|
||||||
<BaseButton size="sm" :icon="Plus" @click="creating = !creating">{{ t('worktrees.new') }}</BaseButton>
|
<button class="btn text-xs" @click="creating = !creating">{{ t('worktrees.new') }}</button>
|
||||||
<BaseButton size="sm" :icon="Scissors" :loading="busy" @click="onPrune">{{ t('worktrees.prune') }}</BaseButton>
|
<button class="btn text-xs" :disabled="busy" @click="onPrune">{{ t('worktrees.prune') }}</button>
|
||||||
<BaseButton
|
<button class="btn-danger text-xs" @click="onRemove">{{ t('repos.remove') }}</button>
|
||||||
size="sm"
|
|
||||||
icon-only
|
|
||||||
:icon="repo.hidden ? Eye : EyeOff"
|
|
||||||
:aria-label="repo.hidden ? t('repos.show') : t('repos.hide')"
|
|
||||||
@click="onToggleHidden"
|
|
||||||
/>
|
|
||||||
<BaseButton variant="danger" size="sm" icon-only :icon="Trash2" :aria-label="t('repos.remove')" @click="onRemove" />
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<form v-if="creating" class="card-inset flex flex-wrap items-end gap-2" @submit.prevent="onCreate">
|
<form v-if="creating" class="flex flex-wrap items-end gap-2 rounded border border-zinc-800 bg-zinc-950/40 p-2" @submit.prevent="onCreate">
|
||||||
<label class="flex flex-1 flex-col gap-1 text-xs text-zinc-400">
|
<label class="flex flex-1 flex-col gap-1 text-xs text-zinc-400">
|
||||||
{{ t('worktrees.branch') }}
|
{{ t('worktrees.branch') }}
|
||||||
<input v-model="branch" class="input font-mono" placeholder="feature/…" required />
|
<input v-model="branch" class="input font-mono" :placeholder="repo.defaultBranch ? `feature/…` : 'feature/…'" required />
|
||||||
</label>
|
</label>
|
||||||
<label class="flex flex-col gap-1 text-xs text-zinc-400">
|
<label class="flex flex-col gap-1 text-xs text-zinc-400">
|
||||||
{{ t('worktrees.start') }}
|
{{ t('worktrees.start') }}
|
||||||
@@ -32,15 +25,14 @@
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
<label class="flex items-center gap-1 text-xs text-zinc-400"><input v-model="newBranch" type="checkbox" /> {{ t('worktrees.newBranch') }}</label>
|
<label class="flex items-center gap-1 text-xs text-zinc-400"><input v-model="newBranch" type="checkbox" /> {{ t('worktrees.newBranch') }}</label>
|
||||||
<BaseButton type="submit" variant="primary" size="sm" :loading="busy" :disabled="branch.trim() === ''">
|
<button type="submit" class="btn-primary text-xs" :disabled="busy || branch.trim() === ''">
|
||||||
{{ t('worktrees.create') }}
|
{{ busy ? t('worktrees.creating') : t('worktrees.create') }}
|
||||||
</BaseButton>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
<p v-if="error" class="text-sm text-red-400">{{ error }}</p>
|
<p v-if="error" class="text-sm text-red-400">{{ error }}</p>
|
||||||
|
|
||||||
<div class="flex flex-col gap-1.5">
|
<div class="flex flex-col gap-1.5">
|
||||||
<WorktreeCard v-for="w in worktrees" :key="w.path" :worktree="w" />
|
<WorktreeCard v-for="w in worktrees" :key="w.path" :worktree="w" />
|
||||||
<p v-if="worktrees.length === 0" class="px-1 text-xs text-zinc-600">{{ t('worktrees.noSession') }}</p>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
@@ -48,23 +40,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, ref } from 'vue';
|
import { computed, ref } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { Eye, EyeOff, Plus, Scissors, Trash2 } from '@lucide/vue';
|
|
||||||
import type { RepoSummary } from '@arboretum/shared';
|
import type { RepoSummary } from '@arboretum/shared';
|
||||||
import { useWorktreesStore } from '../stores/worktrees';
|
import { useWorktreesStore } from '../stores/worktrees';
|
||||||
import { useWorktreeView } from '../composables/useWorktreeView';
|
|
||||||
import { useToastsStore } from '../stores/toasts';
|
|
||||||
import WorktreeCard from './WorktreeCard.vue';
|
import WorktreeCard from './WorktreeCard.vue';
|
||||||
import BaseButton from './ui/BaseButton.vue';
|
|
||||||
import BaseBadge from './ui/BaseBadge.vue';
|
|
||||||
|
|
||||||
const props = defineProps<{ repo: RepoSummary }>();
|
const props = defineProps<{ repo: RepoSummary }>();
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const store = useWorktreesStore();
|
const store = useWorktreesStore();
|
||||||
const view = useWorktreeView();
|
|
||||||
const toasts = useToastsStore();
|
|
||||||
|
|
||||||
// applique le tri/filtre/recherche partagé (toolbar du dashboard) aux worktrees de ce repo.
|
const worktrees = computed(() => store.worktreesForRepo(props.repo.id));
|
||||||
const worktrees = computed(() => view.apply(store.worktreesForRepo(props.repo.id)));
|
|
||||||
const creating = ref(false);
|
const creating = ref(false);
|
||||||
const branch = ref('');
|
const branch = ref('');
|
||||||
const newBranch = ref(true);
|
const newBranch = ref(true);
|
||||||
@@ -79,7 +63,6 @@ async function onCreate(): Promise<void> {
|
|||||||
await store.createWorktree(props.repo.id, { branch: branch.value.trim(), newBranch: newBranch.value, startSession: startSession.value });
|
await store.createWorktree(props.repo.id, { branch: branch.value.trim(), newBranch: newBranch.value, startSession: startSession.value });
|
||||||
branch.value = '';
|
branch.value = '';
|
||||||
creating.value = false;
|
creating.value = false;
|
||||||
toasts.success(t('toast.worktreeCreated'));
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error.value = err instanceof Error ? err.message : String(err);
|
error.value = err instanceof Error ? err.message : String(err);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -92,28 +75,19 @@ async function onPrune(): Promise<void> {
|
|||||||
error.value = null;
|
error.value = null;
|
||||||
try {
|
try {
|
||||||
await store.prune(props.repo.id);
|
await store.prune(props.repo.id);
|
||||||
toasts.success(t('toast.pruned'));
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toasts.error(err);
|
error.value = err instanceof Error ? err.message : String(err);
|
||||||
} finally {
|
} finally {
|
||||||
busy.value = false;
|
busy.value = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onRemove(): Promise<void> {
|
async function onRemove(): Promise<void> {
|
||||||
|
error.value = null;
|
||||||
try {
|
try {
|
||||||
await store.removeRepo(props.repo.id);
|
await store.removeRepo(props.repo.id);
|
||||||
toasts.success(t('toast.repoRemoved'));
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toasts.error(err);
|
error.value = err instanceof Error ? err.message : String(err);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function onToggleHidden(): Promise<void> {
|
|
||||||
try {
|
|
||||||
await store.setHidden(props.repo.id, !props.repo.hidden);
|
|
||||||
} catch (err) {
|
|
||||||
toasts.error(err);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
<template>
|
|
||||||
<!-- focus-within → anneau visuel : montre quelle cellule reçoit la frappe clavier -->
|
|
||||||
<div class="flex min-h-0 flex-col overflow-hidden rounded-lg border border-zinc-800 bg-[#09090b] focus-within:ring-2 focus-within:ring-sky-600">
|
|
||||||
<header class="flex items-center gap-2 border-b border-zinc-800 px-2 py-1">
|
|
||||||
<SessionStateBadge :session="session" />
|
|
||||||
<span class="truncate font-mono text-xs text-zinc-300" :title="session.cwd">{{ title }}</span>
|
|
||||||
<span class="ml-auto shrink-0 font-mono text-[11px] text-zinc-500">{{ session.command }}</span>
|
|
||||||
</header>
|
|
||||||
<DialogPrompt v-if="isWaiting" :session="session" class="px-2 pt-2" />
|
|
||||||
<div class="min-h-0 flex-1">
|
|
||||||
<TerminalView :session-id="session.id" mode="interactive" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed } from 'vue';
|
|
||||||
import type { SessionSummary } from '@arboretum/shared';
|
|
||||||
import { useWorktreesStore } from '../stores/worktrees';
|
|
||||||
import SessionStateBadge from './SessionStateBadge.vue';
|
|
||||||
import DialogPrompt from './DialogPrompt.vue';
|
|
||||||
import TerminalView from './TerminalView.vue';
|
|
||||||
|
|
||||||
const props = defineProps<{ session: SessionSummary }>();
|
|
||||||
const worktrees = useWorktreesStore();
|
|
||||||
|
|
||||||
// libellé : « repo · branche » si le worktree est connu, sinon le dernier segment du cwd.
|
|
||||||
const title = computed(() => {
|
|
||||||
const wt = worktrees.worktrees.find((w) => w.path === props.session.cwd);
|
|
||||||
if (wt) {
|
|
||||||
const repo = worktrees.repos.find((r) => r.id === wt.repoId);
|
|
||||||
const branch = wt.branch ?? wt.head.slice(0, 7);
|
|
||||||
return repo ? `${repo.label} · ${branch}` : branch;
|
|
||||||
}
|
|
||||||
return props.session.cwd.split('/').filter(Boolean).pop() ?? props.session.cwd;
|
|
||||||
});
|
|
||||||
|
|
||||||
const isWaiting = computed(() => props.session.live && props.session.activity === 'waiting' && !!props.session.dialog);
|
|
||||||
</script>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<p v-if="sessions.length === 0" class="text-sm text-zinc-500">{{ t('groups.gridEmpty') }}</p>
|
|
||||||
<template v-else>
|
|
||||||
<p v-if="sessions.length > MAX_CELLS" class="text-xs text-amber-400">
|
|
||||||
{{ t('groups.gridCapped', { shown: MAX_CELLS, total: sessions.length }) }}
|
|
||||||
</p>
|
|
||||||
<!-- une seule socket WS multiplexe tous les terminaux ; cap dur pour préserver GPU/canaux.
|
|
||||||
Sur mobile la grille retombe à une colonne (empilement). -->
|
|
||||||
<div class="grid grid-cols-1 gap-3 lg:grid-cols-2 2xl:grid-cols-3">
|
|
||||||
<TerminalCell v-for="s in shown" :key="s.id" :session="s" class="h-80" />
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import type { SessionSummary } from '@arboretum/shared';
|
|
||||||
import TerminalCell from './TerminalCell.vue';
|
|
||||||
|
|
||||||
const props = defineProps<{ sessions: SessionSummary[] }>();
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const MAX_CELLS = 6;
|
|
||||||
const shown = computed(() => props.sessions.slice(0, MAX_CELLS));
|
|
||||||
</script>
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="pointer-events-none fixed inset-x-0 bottom-0 z-50 flex flex-col items-end gap-2 p-4 sm:bottom-4 sm:right-4 sm:left-auto sm:p-0">
|
|
||||||
<TransitionGroup name="toast">
|
|
||||||
<div
|
|
||||||
v-for="toast in store.toasts"
|
|
||||||
:key="toast.id"
|
|
||||||
class="pointer-events-auto flex w-full max-w-sm items-start gap-2 rounded-lg border px-3 py-2 shadow-pop"
|
|
||||||
:class="toneClass(toast.kind)"
|
|
||||||
:role="toast.kind === 'error' ? 'alert' : 'status'"
|
|
||||||
:aria-live="toast.kind === 'error' ? 'assertive' : 'polite'"
|
|
||||||
>
|
|
||||||
<component :is="icon(toast.kind)" :size="16" class="mt-0.5 shrink-0" />
|
|
||||||
<span class="min-w-0 flex-1 break-words text-sm">{{ toast.message }}</span>
|
|
||||||
<button
|
|
||||||
class="shrink-0 rounded p-0.5 opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-zinc-400/50"
|
|
||||||
:aria-label="t('toast.dismiss')"
|
|
||||||
@click="store.dismiss(toast.id)"
|
|
||||||
>
|
|
||||||
<X :size="14" />
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</TransitionGroup>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { CheckCircle2, AlertTriangle, Info, X } from '@lucide/vue';
|
|
||||||
import { useToastsStore, type ToastKind } from '../stores/toasts';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const store = useToastsStore();
|
|
||||||
|
|
||||||
function toneClass(kind: ToastKind): string {
|
|
||||||
if (kind === 'success') return 'border-emerald-800 bg-emerald-950 text-emerald-200';
|
|
||||||
if (kind === 'error') return 'border-red-800 bg-red-950 text-red-200';
|
|
||||||
return 'border-zinc-700 bg-zinc-900 text-zinc-200';
|
|
||||||
}
|
|
||||||
function icon(kind: ToastKind) {
|
|
||||||
return kind === 'success' ? CheckCircle2 : kind === 'error' ? AlertTriangle : Info;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.toast-enter-active,
|
|
||||||
.toast-leave-active {
|
|
||||||
transition: opacity 0.18s ease, transform 0.18s ease;
|
|
||||||
}
|
|
||||||
.toast-enter-from,
|
|
||||||
.toast-leave-to {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(8px);
|
|
||||||
}
|
|
||||||
@media (prefers-reduced-motion: reduce) {
|
|
||||||
.toast-enter-active,
|
|
||||||
.toast-leave-active {
|
|
||||||
transition: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="flex min-h-0 w-full flex-1 overflow-hidden">
|
|
||||||
<AppSidebar />
|
|
||||||
<div class="flex min-h-0 min-w-0 flex-1 flex-col">
|
|
||||||
<main v-if="fullbleed" class="flex min-h-0 flex-1 flex-col pb-14 md:pb-0">
|
|
||||||
<slot />
|
|
||||||
</main>
|
|
||||||
<main v-else class="flex-1 overflow-y-auto pb-14 md:pb-0">
|
|
||||||
<div class="mx-auto flex w-full max-w-3xl flex-col gap-4 px-4 py-4 md:py-6">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
<MobileTabBar />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// Coquille des vues authentifiées. Propriétaire unique du chargement initial et des abonnements
|
|
||||||
// temps réel (sessions/worktrees/groups) pour toute la durée de la session : fiabilise le badge
|
|
||||||
// de navigation, la palette ⌘K et la section « À traiter » quelle que soit la vue active.
|
|
||||||
import { onMounted, onUnmounted } from 'vue';
|
|
||||||
import { useSessionsStore } from '../../stores/sessions';
|
|
||||||
import { useWorktreesStore } from '../../stores/worktrees';
|
|
||||||
import { useGroupsStore } from '../../stores/groups';
|
|
||||||
import { useSettingsStore } from '../../stores/settings';
|
|
||||||
import AppSidebar from './AppSidebar.vue';
|
|
||||||
import MobileTabBar from './MobileTabBar.vue';
|
|
||||||
|
|
||||||
defineProps<{ fullbleed?: boolean }>();
|
|
||||||
|
|
||||||
const sessions = useSessionsStore();
|
|
||||||
const worktrees = useWorktreesStore();
|
|
||||||
const groups = useGroupsStore();
|
|
||||||
const settings = useSettingsStore();
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
void worktrees.fetchAll();
|
|
||||||
void sessions.fetchSessions();
|
|
||||||
void groups.fetchGroups();
|
|
||||||
void settings.fetch(); // alimente l'icône de nav Gitea et la vue Réglages
|
|
||||||
|
|
||||||
worktrees.startRealtime();
|
|
||||||
sessions.startRealtime();
|
|
||||||
groups.startRealtime();
|
|
||||||
});
|
|
||||||
|
|
||||||
onUnmounted(() => {
|
|
||||||
worktrees.stopRealtime();
|
|
||||||
sessions.stopRealtime();
|
|
||||||
groups.stopRealtime();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<p v-if="pushErrorText" class="text-xs text-amber-400">{{ pushErrorText }}</p>
|
|
||||||
<div class="flex items-center gap-2">
|
|
||||||
<LanguageSwitcher />
|
|
||||||
<BaseButton
|
|
||||||
v-if="push.supported"
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
icon-only
|
|
||||||
:icon="push.enabled ? Bell : BellOff"
|
|
||||||
:class="push.enabled ? 'text-emerald-300' : ''"
|
|
||||||
:disabled="push.busy"
|
|
||||||
:title="pushErrorText || undefined"
|
|
||||||
:aria-label="push.enabled ? t('push.disable') : t('push.enable')"
|
|
||||||
@click="push.toggle()"
|
|
||||||
/>
|
|
||||||
<BaseButton
|
|
||||||
variant="ghost"
|
|
||||||
size="sm"
|
|
||||||
icon-only
|
|
||||||
:icon="LogOut"
|
|
||||||
class="ml-auto"
|
|
||||||
:aria-label="t('common.logout')"
|
|
||||||
@click="logout"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<span v-if="auth.serverVersion" class="text-[11px] text-zinc-600">v{{ auth.serverVersion }}</span>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed, onMounted } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { Bell, BellOff, LogOut } from '@lucide/vue';
|
|
||||||
import { useAuthStore } from '../../stores/auth';
|
|
||||||
import { usePushStore } from '../../stores/push';
|
|
||||||
import { useSession } from '../../composables/useSession';
|
|
||||||
import BaseButton from '../ui/BaseButton.vue';
|
|
||||||
import LanguageSwitcher from '../LanguageSwitcher.vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const auth = useAuthStore();
|
|
||||||
const push = usePushStore();
|
|
||||||
const { logout } = useSession();
|
|
||||||
|
|
||||||
// 'denied'/'unsupported' sont des clés i18n ; tout autre message d'erreur est affiché tel quel.
|
|
||||||
const pushErrorText = computed(() => {
|
|
||||||
const e = push.error;
|
|
||||||
if (!e) return '';
|
|
||||||
return e === 'denied' || e === 'unsupported' ? t(`push.${e}`) : e;
|
|
||||||
});
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
void push.refresh();
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<template>
|
|
||||||
<aside class="hidden w-56 shrink-0 flex-col border-r border-zinc-800/80 bg-zinc-900/40 md:flex">
|
|
||||||
<RouterLink :to="{ name: 'dashboard' }" class="flex items-center gap-2 px-4 py-3.5">
|
|
||||||
<img src="/icon.svg" class="h-7 w-7" alt="" />
|
|
||||||
<span class="text-base font-semibold text-zinc-100">{{ t('common.appName') }}</span>
|
|
||||||
</RouterLink>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="mx-2 mb-2 flex items-center gap-2 rounded-lg border border-zinc-800 bg-zinc-950/40 px-2.5 py-1.5 text-sm text-zinc-500 transition-colors hover:border-zinc-700 hover:text-zinc-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/50"
|
|
||||||
@click="palette.show()"
|
|
||||||
>
|
|
||||||
<Search :size="15" />
|
|
||||||
<span class="flex-1 text-left">{{ t('common.search') }}</span>
|
|
||||||
<kbd class="rounded border border-zinc-700 px-1 text-[10px] text-zinc-500">⌘K</kbd>
|
|
||||||
</button>
|
|
||||||
<nav class="flex flex-1 flex-col gap-1 px-2">
|
|
||||||
<NavItem
|
|
||||||
v-for="item in primary"
|
|
||||||
:key="item.key"
|
|
||||||
:to="item.to"
|
|
||||||
:icon="item.icon"
|
|
||||||
:label="item.label"
|
|
||||||
:badge="item.badge"
|
|
||||||
:active="isActive(item.match)"
|
|
||||||
orientation="row"
|
|
||||||
/>
|
|
||||||
</nav>
|
|
||||||
<nav class="flex flex-col gap-1 px-2 pb-1">
|
|
||||||
<NavItem
|
|
||||||
v-for="item in secondary"
|
|
||||||
:key="item.key"
|
|
||||||
:to="item.to"
|
|
||||||
:href="item.href"
|
|
||||||
:icon="item.icon"
|
|
||||||
:label="item.label"
|
|
||||||
:badge="item.badge"
|
|
||||||
:active="isActive(item.match)"
|
|
||||||
orientation="row"
|
|
||||||
/>
|
|
||||||
</nav>
|
|
||||||
<div class="border-t border-zinc-800/80 p-3">
|
|
||||||
<AppShellFooter />
|
|
||||||
</div>
|
|
||||||
</aside>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { Search } from '@lucide/vue';
|
|
||||||
import { useNav } from '../../composables/useNav';
|
|
||||||
import { useCommandPalette } from '../../composables/useCommandPalette';
|
|
||||||
import NavItem from './NavItem.vue';
|
|
||||||
import AppShellFooter from './AppShellFooter.vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const { primary, secondary, isActive } = useNav();
|
|
||||||
const palette = useCommandPalette();
|
|
||||||
</script>
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
<template>
|
|
||||||
<nav
|
|
||||||
class="fixed inset-x-0 bottom-0 z-40 flex border-t border-zinc-800 bg-zinc-950/95 backdrop-blur md:hidden"
|
|
||||||
style="padding-bottom: env(safe-area-inset-bottom)"
|
|
||||||
>
|
|
||||||
<NavItem
|
|
||||||
v-for="item in primary"
|
|
||||||
:key="item.key"
|
|
||||||
:to="item.to"
|
|
||||||
:icon="item.icon"
|
|
||||||
:label="item.label"
|
|
||||||
:badge="item.badge"
|
|
||||||
:active="isActive(item.match)"
|
|
||||||
orientation="col"
|
|
||||||
class="flex-1"
|
|
||||||
/>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
class="flex flex-1 flex-col items-center gap-0.5 py-2 text-zinc-500 transition-colors hover:text-zinc-300 focus-visible:outline-none"
|
|
||||||
:class="moreActive ? 'text-emerald-400' : ''"
|
|
||||||
@click="showMore = true"
|
|
||||||
>
|
|
||||||
<Menu :size="20" :stroke-width="1.75" />
|
|
||||||
<span class="text-[10px]">{{ t('nav.more') }}</span>
|
|
||||||
</button>
|
|
||||||
<MoreSheet v-if="showMore" @close="showMore = false" />
|
|
||||||
</nav>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed, ref } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { Menu } from '@lucide/vue';
|
|
||||||
import { useNav } from '../../composables/useNav';
|
|
||||||
import NavItem from './NavItem.vue';
|
|
||||||
import MoreSheet from './MoreSheet.vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const { primary, secondary, isActive } = useNav();
|
|
||||||
const showMore = ref(false);
|
|
||||||
// « More » est actif quand la route courante appartient aux items secondaires (Réglages/Aide).
|
|
||||||
const moreActive = computed(() => secondary.value.some((i) => isActive(i.match)));
|
|
||||||
</script>
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
<template>
|
|
||||||
<Teleport to="body">
|
|
||||||
<div class="fixed inset-0 z-50 md:hidden" role="dialog" aria-modal="true">
|
|
||||||
<div class="absolute inset-0 bg-black/60" @click="emit('close')" />
|
|
||||||
<div
|
|
||||||
class="absolute inset-x-0 bottom-0 rounded-t-2xl border-t border-zinc-800 bg-zinc-900 p-4 shadow-pop"
|
|
||||||
style="padding-bottom: calc(1rem + env(safe-area-inset-bottom))"
|
|
||||||
>
|
|
||||||
<div class="mx-auto mb-3 h-1 w-10 rounded-full bg-zinc-700" />
|
|
||||||
<nav class="mb-3 flex flex-col gap-1">
|
|
||||||
<NavItem
|
|
||||||
v-for="item in secondary"
|
|
||||||
:key="item.key"
|
|
||||||
:to="item.to"
|
|
||||||
:href="item.href"
|
|
||||||
:icon="item.icon"
|
|
||||||
:label="item.label"
|
|
||||||
:active="isActive(item.match)"
|
|
||||||
orientation="row"
|
|
||||||
@click="emit('close')"
|
|
||||||
/>
|
|
||||||
</nav>
|
|
||||||
<div class="border-t border-zinc-800/80 pt-3">
|
|
||||||
<AppShellFooter />
|
|
||||||
</div>
|
|
||||||
<BaseButton class="mt-3 w-full" @click="emit('close')">{{ t('common.close') }}</BaseButton>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Teleport>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { useNav } from '../../composables/useNav';
|
|
||||||
import NavItem from './NavItem.vue';
|
|
||||||
import AppShellFooter from './AppShellFooter.vue';
|
|
||||||
import BaseButton from '../ui/BaseButton.vue';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
const { secondary, isActive } = useNav();
|
|
||||||
const emit = defineEmits<{ close: [] }>();
|
|
||||||
</script>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<template>
|
|
||||||
<!-- RouterLink pour une route interne ; <a target=_blank> pour un lien externe (ex. Gitea). -->
|
|
||||||
<component
|
|
||||||
:is="href ? 'a' : RouterLink"
|
|
||||||
:to="href ? undefined : to"
|
|
||||||
:href="href"
|
|
||||||
:target="href ? '_blank' : undefined"
|
|
||||||
:rel="href ? 'noopener noreferrer' : undefined"
|
|
||||||
:aria-current="!href && active ? 'page' : undefined"
|
|
||||||
:class="orientation === 'col' ? colClass : rowClass"
|
|
||||||
>
|
|
||||||
<span class="relative">
|
|
||||||
<component :is="icon" :size="orientation === 'col' ? 20 : 18" :stroke-width="1.75" />
|
|
||||||
<span
|
|
||||||
v-if="badge"
|
|
||||||
class="absolute -right-1.5 -top-1.5 flex h-3.5 min-w-3.5 items-center justify-center rounded-full bg-amber-500 px-1 text-[9px] font-semibold text-amber-950"
|
|
||||||
>
|
|
||||||
{{ badge }}
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<span :class="orientation === 'col' ? 'text-[10px]' : 'flex-1'">{{ label }}</span>
|
|
||||||
<span
|
|
||||||
v-if="badge && orientation === 'row'"
|
|
||||||
class="rounded-full bg-amber-500/20 px-1.5 text-[11px] font-semibold text-amber-300"
|
|
||||||
>
|
|
||||||
{{ badge }}
|
|
||||||
</span>
|
|
||||||
</component>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { computed, type Component } from 'vue';
|
|
||||||
import { RouterLink, type RouteLocationRaw } from 'vue-router';
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
// `| undefined` requis par exactOptionalPropertyTypes : les items de nav passent `to`/`href`
|
|
||||||
// potentiellement undefined (l'un ou l'autre selon route interne vs lien externe).
|
|
||||||
to?: RouteLocationRaw | undefined;
|
|
||||||
href?: string | undefined;
|
|
||||||
icon: Component;
|
|
||||||
label: string;
|
|
||||||
badge?: number;
|
|
||||||
active?: boolean;
|
|
||||||
orientation?: 'row' | 'col';
|
|
||||||
}>(),
|
|
||||||
{ orientation: 'row' },
|
|
||||||
);
|
|
||||||
|
|
||||||
const rowClass = computed(() => [
|
|
||||||
'flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/70',
|
|
||||||
props.active ? 'bg-zinc-800 text-zinc-100' : 'text-zinc-400 hover:bg-zinc-800/50 hover:text-zinc-200',
|
|
||||||
]);
|
|
||||||
const colClass = computed(() => [
|
|
||||||
'flex flex-1 flex-col items-center gap-0.5 py-2 transition-colors focus-visible:outline-none',
|
|
||||||
props.active ? 'text-emerald-400' : 'text-zinc-500 hover:text-zinc-300',
|
|
||||||
]);
|
|
||||||
</script>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<template>
|
|
||||||
<header class="flex flex-wrap items-center gap-x-3 gap-y-2">
|
|
||||||
<div class="flex min-w-0 items-center gap-2">
|
|
||||||
<slot name="title">
|
|
||||||
<h1 class="truncate text-lg font-semibold text-zinc-100">{{ title }}</h1>
|
|
||||||
</slot>
|
|
||||||
<span v-if="subtitle" class="truncate font-mono text-xs text-zinc-500" :title="subtitle">{{ subtitle }}</span>
|
|
||||||
</div>
|
|
||||||
<div v-if="$slots.default" class="ml-auto flex flex-wrap items-center gap-2">
|
|
||||||
<slot />
|
|
||||||
</div>
|
|
||||||
<div v-if="$slots.search" class="w-full">
|
|
||||||
<slot name="search" />
|
|
||||||
</div>
|
|
||||||
</header>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// En-tête de contenu : titre (ou slot #title pour un titre riche) + slot d'actions + slot recherche.
|
|
||||||
defineProps<{ title?: string; subtitle?: string }>();
|
|
||||||
</script>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="border-b border-amber-900/50 bg-amber-950/80 px-4 py-1.5 text-center text-xs text-amber-300">
|
|
||||||
{{ t('ws.reconnecting') }}
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
|
|
||||||
const { t } = useI18n();
|
|
||||||
</script>
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<template>
|
|
||||||
<!-- Ligne de config serveur en lecture seule : label + valeur (+ flag CLI) + copier. -->
|
|
||||||
<div class="flex flex-wrap items-center gap-x-3 gap-y-0.5 py-2">
|
|
||||||
<dt class="w-40 shrink-0 text-sm text-zinc-400">{{ label }}</dt>
|
|
||||||
<dd class="flex min-w-0 flex-1 items-center gap-2">
|
|
||||||
<span :class="['min-w-0 flex-1 break-all text-sm text-zinc-200', mono ? 'font-mono text-xs' : '']">{{ value }}</span>
|
|
||||||
<span v-if="flag" class="hidden shrink-0 font-mono text-[11px] text-zinc-600 sm:inline" :title="t('settings.flagHint', { flag })">{{ flag }}</span>
|
|
||||||
<BaseButton size="sm" variant="ghost" icon-only :icon="copied ? Check : Copy" :aria-label="t('settings.copy')" @click="copy" />
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref } from 'vue';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { Check, Copy } from '@lucide/vue';
|
|
||||||
import BaseButton from '../ui/BaseButton.vue';
|
|
||||||
|
|
||||||
const props = defineProps<{ label: string; value: string; flag?: string; mono?: boolean }>();
|
|
||||||
const { t } = useI18n();
|
|
||||||
|
|
||||||
const copied = ref(false);
|
|
||||||
// Auto-contenu : on ne confirme (✓) qu'après la résolution réelle de l'écriture presse-papiers.
|
|
||||||
async function copy(): Promise<void> {
|
|
||||||
try {
|
|
||||||
await navigator.clipboard.writeText(props.value);
|
|
||||||
copied.value = true;
|
|
||||||
setTimeout(() => (copied.value = false), 1500);
|
|
||||||
} catch {
|
|
||||||
/* presse-papiers indisponible (http non sécurisé) : silencieux */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<template>
|
|
||||||
<span class="badge" :class="toneClass">
|
|
||||||
<span v-if="dot" class="inline-block h-1.5 w-1.5 rounded-full" :class="dotClass" />
|
|
||||||
<slot />
|
|
||||||
</span>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// Pastille d'état : centralise les paires bg/text répétées (zinc/emerald/amber/sky/red).
|
|
||||||
import { computed } from 'vue';
|
|
||||||
|
|
||||||
type Tone = 'zinc' | 'emerald' | 'amber' | 'sky' | 'red';
|
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{ tone?: Tone; dot?: boolean; pulse?: boolean }>(), {
|
|
||||||
tone: 'zinc',
|
|
||||||
});
|
|
||||||
|
|
||||||
const TONES: Record<Tone, string> = {
|
|
||||||
zinc: 'bg-zinc-800 text-zinc-400',
|
|
||||||
emerald: 'bg-emerald-950 text-emerald-400',
|
|
||||||
amber: 'bg-amber-950 text-amber-300',
|
|
||||||
sky: 'bg-sky-950 text-sky-300',
|
|
||||||
red: 'bg-red-950 text-red-400',
|
|
||||||
};
|
|
||||||
const DOTS: Record<Tone, string> = {
|
|
||||||
zinc: 'bg-zinc-500',
|
|
||||||
emerald: 'bg-emerald-400',
|
|
||||||
amber: 'bg-amber-300',
|
|
||||||
sky: 'bg-sky-300',
|
|
||||||
red: 'bg-red-400',
|
|
||||||
};
|
|
||||||
|
|
||||||
const toneClass = computed(() => TONES[props.tone]);
|
|
||||||
const dotClass = computed(() => [DOTS[props.tone], props.pulse ? 'animate-pulse' : '']);
|
|
||||||
</script>
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
<template>
|
|
||||||
<component
|
|
||||||
:is="tag"
|
|
||||||
:class="classes"
|
|
||||||
v-bind="mergedAttrs"
|
|
||||||
@click="onClick"
|
|
||||||
>
|
|
||||||
<Loader2 v-if="loading" :size="iconSize" class="animate-spin" />
|
|
||||||
<component :is="icon" v-else-if="icon" :size="iconSize" />
|
|
||||||
<slot />
|
|
||||||
</component>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// Bouton unifié : variantes + tailles + état loading + anneau de focus cohérent.
|
|
||||||
// Rend un <RouterLink> quand `to` est fourni (et actionnable), sinon un <button>.
|
|
||||||
import { computed, useAttrs, type Component } from 'vue';
|
|
||||||
import { RouterLink, type RouteLocationRaw } from 'vue-router';
|
|
||||||
import { Loader2 } from '@lucide/vue';
|
|
||||||
|
|
||||||
defineOptions({ inheritAttrs: false });
|
|
||||||
|
|
||||||
const props = withDefaults(
|
|
||||||
defineProps<{
|
|
||||||
variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
|
|
||||||
size?: 'sm' | 'md';
|
|
||||||
loading?: boolean;
|
|
||||||
disabled?: boolean;
|
|
||||||
iconOnly?: boolean;
|
|
||||||
icon?: Component;
|
|
||||||
to?: RouteLocationRaw;
|
|
||||||
type?: 'button' | 'submit';
|
|
||||||
}>(),
|
|
||||||
{ variant: 'secondary', size: 'md', type: 'button' },
|
|
||||||
);
|
|
||||||
|
|
||||||
const emit = defineEmits<{ click: [MouseEvent] }>();
|
|
||||||
const attrs = useAttrs();
|
|
||||||
|
|
||||||
const isDisabled = computed(() => props.disabled || props.loading);
|
|
||||||
const asLink = computed(() => props.to !== undefined && !isDisabled.value);
|
|
||||||
const tag = computed(() => (asLink.value ? RouterLink : 'button'));
|
|
||||||
const iconSize = computed(() => (props.size === 'sm' ? 15 : 16));
|
|
||||||
|
|
||||||
const BASE =
|
|
||||||
'inline-flex items-center justify-center gap-1.5 rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-offset-zinc-950 disabled:cursor-not-allowed disabled:opacity-50';
|
|
||||||
|
|
||||||
const VARIANTS: Record<NonNullable<typeof props.variant>, string> = {
|
|
||||||
primary: 'bg-emerald-600 text-white hover:bg-emerald-500 focus-visible:ring-emerald-500/70',
|
|
||||||
secondary: 'border border-zinc-700 bg-zinc-800 text-zinc-200 hover:bg-zinc-700 focus-visible:ring-emerald-500/70',
|
|
||||||
ghost: 'text-zinc-300 hover:bg-zinc-800/60 focus-visible:ring-emerald-500/70',
|
|
||||||
danger: 'border border-red-900 bg-red-950 text-red-300 hover:bg-red-900 focus-visible:ring-red-500/70',
|
|
||||||
};
|
|
||||||
|
|
||||||
const SIZES = {
|
|
||||||
sm: { text: 'h-8 px-2.5 text-xs', icon: 'h-8 w-8' },
|
|
||||||
md: { text: 'h-9 px-3 text-sm', icon: 'h-9 w-9' },
|
|
||||||
};
|
|
||||||
|
|
||||||
const classes = computed(() => {
|
|
||||||
const size = SIZES[props.size];
|
|
||||||
return [BASE, VARIANTS[props.variant], props.iconOnly ? size.icon : size.text];
|
|
||||||
});
|
|
||||||
|
|
||||||
// Attributs natifs propres au tag rendu (button : type/disabled/aria-busy ; lien : to).
|
|
||||||
const nativeProps = computed(() => {
|
|
||||||
if (asLink.value) return { to: props.to };
|
|
||||||
return { type: props.type, disabled: isDisabled.value, 'aria-busy': props.loading || undefined };
|
|
||||||
});
|
|
||||||
// useAttrs (class/aria-label/etc. du parent) + props natifs.
|
|
||||||
const mergedAttrs = computed(() => ({ ...attrs, ...nativeProps.value }));
|
|
||||||
|
|
||||||
function onClick(e: MouseEvent): void {
|
|
||||||
if (isDisabled.value) {
|
|
||||||
e.preventDefault();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
emit('click', e);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="flex flex-col items-center gap-2 rounded-xl border border-dashed border-zinc-800 px-6 py-10 text-center">
|
|
||||||
<component :is="icon" v-if="icon" :size="32" class="text-zinc-600" :stroke-width="1.5" />
|
|
||||||
<p class="text-sm font-medium text-zinc-300">{{ title }}</p>
|
|
||||||
<p v-if="hint" class="max-w-sm text-xs text-zinc-500">{{ hint }}</p>
|
|
||||||
<div v-if="$slots.action" class="mt-1">
|
|
||||||
<slot name="action" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// État vide soigné (icône + titre + indice + CTA) — remplace les <p text-zinc-500> plats.
|
|
||||||
import type { Component } from 'vue';
|
|
||||||
|
|
||||||
defineProps<{ icon?: Component; title: string; hint?: string }>();
|
|
||||||
</script>
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
<template>
|
|
||||||
<!-- Lucide n'a pas d'icône Gitea : motif « tasse de thé fumante » (git + tea), trait cohérent
|
|
||||||
avec les icônes Lucide (currentColor, coins arrondis). stroke-width hérité via fallthrough. -->
|
|
||||||
<svg
|
|
||||||
:width="size"
|
|
||||||
:height="size"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
stroke-width="1.75"
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
aria-hidden="true"
|
|
||||||
>
|
|
||||||
<!-- vapeur = mini-branche git -->
|
|
||||||
<path d="M9 5.5V4" />
|
|
||||||
<path d="M13 5.5V3" />
|
|
||||||
<circle cx="9" cy="3" r="0.6" fill="currentColor" stroke="none" />
|
|
||||||
<circle cx="13" cy="2.5" r="0.6" fill="currentColor" stroke="none" />
|
|
||||||
<!-- tasse -->
|
|
||||||
<path d="M4 8h12v4a5 5 0 0 1-5 5H9a5 5 0 0 1-5-5z" />
|
|
||||||
<!-- anse -->
|
|
||||||
<path d="M16 9h1.5a2.5 2.5 0 0 1 0 5H16" />
|
|
||||||
<!-- soucoupe -->
|
|
||||||
<path d="M5 20h10" />
|
|
||||||
</svg>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
withDefaults(defineProps<{ size?: number }>(), { size: 18 });
|
|
||||||
</script>
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="inline-flex rounded-lg border border-zinc-800 bg-zinc-950/40 p-0.5">
|
|
||||||
<button
|
|
||||||
v-for="opt in options"
|
|
||||||
:key="opt.value"
|
|
||||||
type="button"
|
|
||||||
class="inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/70"
|
|
||||||
:class="opt.value === modelValue ? 'bg-zinc-800 text-zinc-100' : 'text-zinc-400 hover:text-zinc-200'"
|
|
||||||
:aria-pressed="opt.value === modelValue"
|
|
||||||
@click="emit('update:modelValue', opt.value)"
|
|
||||||
>
|
|
||||||
<component :is="opt.icon" v-if="opt.icon" :size="15" />
|
|
||||||
<span v-if="opt.label">{{ opt.label }}</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// Bascule segmentée (ex. liste / grille) : remplace le toggle bricolé inline.
|
|
||||||
import type { Component } from 'vue';
|
|
||||||
|
|
||||||
export interface SegmentOption {
|
|
||||||
value: string;
|
|
||||||
label?: string;
|
|
||||||
icon?: Component;
|
|
||||||
}
|
|
||||||
|
|
||||||
defineProps<{ modelValue: string; options: SegmentOption[] }>();
|
|
||||||
const emit = defineEmits<{ 'update:modelValue': [string] }>();
|
|
||||||
</script>
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="flex flex-col gap-2">
|
|
||||||
<div
|
|
||||||
v-for="i in count"
|
|
||||||
:key="i"
|
|
||||||
class="animate-pulse rounded-xl border border-zinc-800 bg-zinc-900/40 motion-reduce:animate-none"
|
|
||||||
:style="{ height: `${height}px` }"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
// Squelette de chargement : garde la hauteur stable, évite le layout shift.
|
|
||||||
withDefaults(defineProps<{ count?: number; height?: number }>(), { count: 3, height: 64 });
|
|
||||||
</script>
|
|
||||||
@@ -1,161 +0,0 @@
|
|||||||
import type { GroupSummary, RepoSummary, SessionSummary, WorktreeSummary } from '@arboretum/shared';
|
|
||||||
import type { FilterDef, SortDef } from './useListControls';
|
|
||||||
|
|
||||||
// ---- état canonique d'une session (réutilise la logique de SessionStateBadge) ----
|
|
||||||
type CanonState = 'waiting' | 'busy' | 'idle' | null;
|
|
||||||
const canonState = (s: SessionSummary): CanonState => (s.activity ?? s.registryStatus ?? null);
|
|
||||||
|
|
||||||
/** Rang d'actionnabilité : waiting(0) < busy(1) < idle(2) < live(3) < resumable(4) < exited(5). */
|
|
||||||
export function sessionStateRank(s: SessionSummary): number {
|
|
||||||
if (s.live) {
|
|
||||||
const st = canonState(s);
|
|
||||||
return st === 'waiting' ? 0 : st === 'busy' ? 1 : st === 'idle' ? 2 : 3;
|
|
||||||
}
|
|
||||||
return s.resumable ? 4 : 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Une session correspond-elle à une valeur d'état de filtre ? */
|
|
||||||
function sessionMatchesState(s: SessionSummary, value: string): boolean {
|
|
||||||
switch (value) {
|
|
||||||
case 'live':
|
|
||||||
return s.live;
|
|
||||||
case 'waiting':
|
|
||||||
case 'busy':
|
|
||||||
case 'idle':
|
|
||||||
return s.live && canonState(s) === value;
|
|
||||||
case 'exited':
|
|
||||||
return !s.live && !s.resumable;
|
|
||||||
case 'resumable':
|
|
||||||
return !s.live && s.resumable;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- sessions ----
|
|
||||||
export function sessionSorts(): SortDef<SessionSummary>[] {
|
|
||||||
return [
|
|
||||||
{ key: 'state', labelKey: 'sort.session.state', compare: (a, b) => sessionStateRank(a) - sessionStateRank(b), defaultDir: 'asc' },
|
|
||||||
{ key: 'recent', labelKey: 'sort.session.recent', compare: (a, b) => a.createdAt.localeCompare(b.createdAt), defaultDir: 'desc' },
|
|
||||||
{ key: 'clients', labelKey: 'sort.session.clients', compare: (a, b) => a.clients - b.clients, defaultDir: 'desc' },
|
|
||||||
{ key: 'cwd', labelKey: 'sort.session.cwd', compare: (a, b) => a.cwd.localeCompare(b.cwd), defaultDir: 'asc' },
|
|
||||||
{ key: 'command', labelKey: 'sort.session.command', compare: (a, b) => a.command.localeCompare(b.command), defaultDir: 'asc' },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function sessionFilters(repos: readonly RepoSummary[]): FilterDef<SessionSummary>[] {
|
|
||||||
const STATES = ['live', 'waiting', 'busy', 'idle', 'exited', 'resumable'];
|
|
||||||
// corrélation session→repo par préfixe de chemin (cwd sous repo.path).
|
|
||||||
const repoPaths = repos.map((r) => ({ id: r.id, path: r.path }));
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
key: 'state',
|
|
||||||
labelKey: 'filter.state.label',
|
|
||||||
options: STATES.map((v) => ({ value: v, labelKey: `filter.state.${v}` })),
|
|
||||||
predicate: (s, active) => [...active].some((v) => sessionMatchesState(s, v)),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'command',
|
|
||||||
labelKey: 'filter.command.label',
|
|
||||||
options: [
|
|
||||||
{ value: 'claude', label: 'claude' },
|
|
||||||
{ value: 'bash', label: 'bash' },
|
|
||||||
],
|
|
||||||
predicate: (s, active) => active.has(s.command),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'source',
|
|
||||||
labelKey: 'filter.source.label',
|
|
||||||
options: [
|
|
||||||
{ value: 'managed', labelKey: 'filter.source.managed' },
|
|
||||||
{ value: 'discovered', labelKey: 'filter.source.discovered' },
|
|
||||||
],
|
|
||||||
predicate: (s, active) => active.has(s.source),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'repo',
|
|
||||||
labelKey: 'filter.repo.label',
|
|
||||||
options: repos.map((r) => ({ value: r.id, label: r.label })),
|
|
||||||
predicate: (s, active) =>
|
|
||||||
repoPaths.some((r) => active.has(r.id) && (s.cwd === r.path || s.cwd.startsWith(r.path + '/'))),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- worktrees ----
|
|
||||||
function worktreeActivityRank(w: WorktreeSummary): number {
|
|
||||||
if (w.sessions.length === 0) return 99;
|
|
||||||
return Math.min(...w.sessions.map(sessionStateRank));
|
|
||||||
}
|
|
||||||
|
|
||||||
export function worktreeSorts(): SortDef<WorktreeSummary>[] {
|
|
||||||
return [
|
|
||||||
{ key: 'main', labelKey: 'sort.worktree.main', compare: (a, b) => Number(b.isMain) - Number(a.isMain), defaultDir: 'asc' },
|
|
||||||
{ key: 'branch', labelKey: 'sort.worktree.branch', compare: (a, b) => (a.branch ?? '').localeCompare(b.branch ?? ''), defaultDir: 'asc' },
|
|
||||||
{ key: 'dirty', labelKey: 'sort.worktree.dirty', compare: (a, b) => a.git.dirtyCount - b.git.dirtyCount, defaultDir: 'desc' },
|
|
||||||
{ key: 'ahead', labelKey: 'sort.worktree.ahead', compare: (a, b) => a.git.ahead - b.git.ahead, defaultDir: 'desc' },
|
|
||||||
{ key: 'behind', labelKey: 'sort.worktree.behind', compare: (a, b) => a.git.behind - b.git.behind, defaultDir: 'desc' },
|
|
||||||
{ key: 'activity', labelKey: 'sort.worktree.activity', compare: (a, b) => worktreeActivityRank(a) - worktreeActivityRank(b), defaultDir: 'asc' },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
export function worktreeFilters(): FilterDef<WorktreeSummary>[] {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
key: 'dirtiness',
|
|
||||||
labelKey: 'filter.worktree.dirtiness',
|
|
||||||
options: [
|
|
||||||
{ value: 'dirty', labelKey: 'filter.worktree.dirty' },
|
|
||||||
{ value: 'clean', labelKey: 'filter.worktree.clean' },
|
|
||||||
],
|
|
||||||
predicate: (w, active) =>
|
|
||||||
(active.has('dirty') && w.git.dirtyCount > 0) || (active.has('clean') && w.git.dirtyCount === 0),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'session',
|
|
||||||
labelKey: 'filter.worktree.session',
|
|
||||||
options: [
|
|
||||||
{ value: 'with', labelKey: 'filter.worktree.with' },
|
|
||||||
{ value: 'without', labelKey: 'filter.worktree.without' },
|
|
||||||
],
|
|
||||||
predicate: (w, active) =>
|
|
||||||
(active.has('with') && w.sessions.length > 0) || (active.has('without') && w.sessions.length === 0),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'flags',
|
|
||||||
labelKey: 'filter.worktree.flags',
|
|
||||||
options: [
|
|
||||||
{ value: 'locked', labelKey: 'filter.worktree.locked' },
|
|
||||||
{ value: 'prunable', labelKey: 'filter.worktree.prunable' },
|
|
||||||
],
|
|
||||||
predicate: (w, active) => (active.has('locked') && w.locked) || (active.has('prunable') && w.prunable),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- repos ----
|
|
||||||
export interface RepoSortCtx {
|
|
||||||
worktreeCount: (repoId: string) => number;
|
|
||||||
activeCount: (repoId: string) => number;
|
|
||||||
}
|
|
||||||
export function repoSorts(ctx: RepoSortCtx): SortDef<RepoSummary>[] {
|
|
||||||
return [
|
|
||||||
{ key: 'label', labelKey: 'sort.repo.label', compare: (a, b) => a.label.localeCompare(b.label), defaultDir: 'asc' },
|
|
||||||
{ key: 'created', labelKey: 'sort.repo.created', compare: (a, b) => a.createdAt.localeCompare(b.createdAt), defaultDir: 'desc' },
|
|
||||||
{ key: 'worktrees', labelKey: 'sort.repo.worktrees', compare: (a, b) => ctx.worktreeCount(a.id) - ctx.worktreeCount(b.id), defaultDir: 'desc' },
|
|
||||||
{ key: 'activity', labelKey: 'sort.repo.activity', compare: (a, b) => ctx.activeCount(a.id) - ctx.activeCount(b.id), defaultDir: 'desc' },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
// ---- groupes ----
|
|
||||||
export interface GroupSortCtx {
|
|
||||||
activeCount: (groupId: string) => number;
|
|
||||||
}
|
|
||||||
export function groupSorts(ctx: GroupSortCtx): SortDef<GroupSummary>[] {
|
|
||||||
return [
|
|
||||||
{ key: 'label', labelKey: 'sort.group.label', compare: (a, b) => a.label.localeCompare(b.label), defaultDir: 'asc' },
|
|
||||||
{ key: 'created', labelKey: 'sort.group.created', compare: (a, b) => a.createdAt.localeCompare(b.createdAt), defaultDir: 'desc' },
|
|
||||||
{ key: 'repos', labelKey: 'sort.group.repos', compare: (a, b) => a.repoIds.length - b.repoIds.length, defaultDir: 'desc' },
|
|
||||||
{ key: 'activeSessions', labelKey: 'sort.group.activeSessions', compare: (a, b) => ctx.activeCount(a.id) - ctx.activeCount(b.id), defaultDir: 'desc' },
|
|
||||||
];
|
|
||||||
}
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import { ref } from 'vue';
|
|
||||||
|
|
||||||
// Singleton module-level : l'ouverture est pilotée par le raccourci global ⌘K et par
|
|
||||||
// d'éventuels boutons (ex. sidebar). Un seul CommandPalette est monté dans App.vue.
|
|
||||||
const open = ref(false);
|
|
||||||
|
|
||||||
export function useCommandPalette() {
|
|
||||||
return {
|
|
||||||
open,
|
|
||||||
toggle: (): void => {
|
|
||||||
open.value = !open.value;
|
|
||||||
},
|
|
||||||
show: (): void => {
|
|
||||||
open.value = true;
|
|
||||||
},
|
|
||||||
close: (): void => {
|
|
||||||
open.value = false;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import { ref, watch, onUnmounted, getCurrentInstance, type Ref } from 'vue';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renvoie un miroir débouncé d'un ref source. Le ref source reste instantané (idéal pour un
|
|
||||||
* v-model d'input) ; le miroir ne se met à jour qu'après `delay` ms de stabilité — c'est lui
|
|
||||||
* que le pipeline de tri/filtre consomme, pour ne pas recalculer à chaque frappe.
|
|
||||||
*/
|
|
||||||
export function useDebouncedRef<T>(source: Ref<T>, delay = 150): Ref<T> {
|
|
||||||
const debounced = ref(source.value) as Ref<T>;
|
|
||||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
||||||
|
|
||||||
watch(source, (v) => {
|
|
||||||
clearTimeout(timer);
|
|
||||||
timer = setTimeout(() => {
|
|
||||||
debounced.value = v;
|
|
||||||
}, delay);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (getCurrentInstance()) onUnmounted(() => clearTimeout(timer));
|
|
||||||
|
|
||||||
return debounced;
|
|
||||||
}
|
|
||||||
@@ -1,290 +0,0 @@
|
|||||||
import { computed, ref, watch, type ComputedRef, type Ref } from 'vue';
|
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
|
||||||
import { useDebouncedRef } from './useDebouncedRef';
|
|
||||||
|
|
||||||
export type SortDir = 'asc' | 'desc';
|
|
||||||
|
|
||||||
/** Comparateur d'une clé de tri, toujours écrit en ASC ; la direction est appliquée par le composable. */
|
|
||||||
export interface SortDef<T> {
|
|
||||||
key: string;
|
|
||||||
labelKey: string;
|
|
||||||
compare: (a: T, b: T) => number;
|
|
||||||
defaultDir?: SortDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FilterOption {
|
|
||||||
value: string;
|
|
||||||
labelKey?: string;
|
|
||||||
label?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Un filtre activable par une ou plusieurs valeurs (OR intra-filtre, AND inter-filtres). */
|
|
||||||
export interface FilterDef<T> {
|
|
||||||
key: string;
|
|
||||||
labelKey: string;
|
|
||||||
options: FilterOption[];
|
|
||||||
predicate: (item: T, active: Set<string>) => boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ListControlsOptions<T> {
|
|
||||||
source: () => readonly T[];
|
|
||||||
sorts: SortDef<T>[];
|
|
||||||
/** Tableau statique ou getter (pour des options dérivées d'un store chargé en asynchrone). */
|
|
||||||
filters?: FilterDef<T>[] | (() => FilterDef<T>[]);
|
|
||||||
searchAccessor?: (item: T) => string;
|
|
||||||
defaultSortKey?: string;
|
|
||||||
defaultPageSize?: number; // 0 = tout afficher
|
|
||||||
/** Si fourni, l'état est synchronisé dans l'URL sous des params préfixés (liens partageables). */
|
|
||||||
urlKey?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Sous-ensemble consommé par ListToolbar (sans pagination) — implémentable aussi par un store partagé. */
|
|
||||||
export interface ListToolbarControls<T> {
|
|
||||||
search: Ref<string>;
|
|
||||||
sortKey: Ref<string>;
|
|
||||||
sortDir: Ref<SortDir>;
|
|
||||||
filters: Ref<Record<string, Set<string>>>;
|
|
||||||
total: ComputedRef<number>;
|
|
||||||
activeFilterCount: ComputedRef<number>;
|
|
||||||
setSearch(v: string): void;
|
|
||||||
setSort(key: string): void;
|
|
||||||
toggleFilter(key: string, value: string): void;
|
|
||||||
clearAll(): void;
|
|
||||||
sortDefs: SortDef<T>[];
|
|
||||||
filterDefs: ComputedRef<FilterDef<T>[]>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ListControls<T> extends ListToolbarControls<T> {
|
|
||||||
page: Ref<number>;
|
|
||||||
pageSize: Ref<number>;
|
|
||||||
processed: ComputedRef<T[]>;
|
|
||||||
pageCount: ComputedRef<number>;
|
|
||||||
setPage(p: number): void;
|
|
||||||
setPageSize(n: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useListControls<T>(opts: ListControlsOptions<T>): ListControls<T> {
|
|
||||||
const sortDefs = opts.sorts;
|
|
||||||
const filterDefs = computed<FilterDef<T>[]>(() =>
|
|
||||||
typeof opts.filters === 'function' ? opts.filters() : (opts.filters ?? []),
|
|
||||||
);
|
|
||||||
const defaultSortKey = opts.defaultSortKey ?? sortDefs[0]?.key ?? '';
|
|
||||||
const defaultPageSize = opts.defaultPageSize ?? 25;
|
|
||||||
|
|
||||||
const search = ref('');
|
|
||||||
const sortKey = ref(defaultSortKey);
|
|
||||||
const sortDir = ref<SortDir>(sortDefs.find((s) => s.key === defaultSortKey)?.defaultDir ?? 'asc');
|
|
||||||
const filters = ref<Record<string, Set<string>>>({});
|
|
||||||
const page = ref(1);
|
|
||||||
const pageSize = ref(defaultPageSize);
|
|
||||||
|
|
||||||
const debouncedSearch = useDebouncedRef(search, 150);
|
|
||||||
|
|
||||||
// ---- pipeline : filtres → recherche → tri → pagination (computed purs, aucune mutation de store) ----
|
|
||||||
const filtered = computed<T[]>(() => {
|
|
||||||
let items = [...opts.source()];
|
|
||||||
for (const def of filterDefs.value) {
|
|
||||||
const active = filters.value[def.key];
|
|
||||||
if (active && active.size > 0) items = items.filter((it) => def.predicate(it, active));
|
|
||||||
}
|
|
||||||
const q = debouncedSearch.value.trim().toLowerCase();
|
|
||||||
if (q && opts.searchAccessor) {
|
|
||||||
items = items.filter((it) => opts.searchAccessor!(it).toLowerCase().includes(q));
|
|
||||||
}
|
|
||||||
return items;
|
|
||||||
});
|
|
||||||
|
|
||||||
const sorted = computed<T[]>(() => {
|
|
||||||
const def = sortDefs.find((s) => s.key === sortKey.value) ?? sortDefs[0];
|
|
||||||
if (!def) return filtered.value;
|
|
||||||
const dir = sortDir.value === 'desc' ? -1 : 1;
|
|
||||||
return [...filtered.value].sort((a, b) => def.compare(a, b) * dir);
|
|
||||||
});
|
|
||||||
|
|
||||||
const total = computed(() => filtered.value.length);
|
|
||||||
const pageCount = computed(() => (pageSize.value === 0 ? 1 : Math.max(1, Math.ceil(total.value / pageSize.value))));
|
|
||||||
const processed = computed<T[]>(() => {
|
|
||||||
if (pageSize.value === 0) return sorted.value;
|
|
||||||
const start = (page.value - 1) * pageSize.value;
|
|
||||||
return sorted.value.slice(start, start + pageSize.value);
|
|
||||||
});
|
|
||||||
const activeFilterCount = computed(() =>
|
|
||||||
Object.values(filters.value).reduce((n, set) => n + set.size, 0),
|
|
||||||
);
|
|
||||||
|
|
||||||
// ramène la page dans les bornes quand un filtre réduit le total.
|
|
||||||
watch(pageCount, (count) => {
|
|
||||||
if (page.value > count) page.value = count;
|
|
||||||
});
|
|
||||||
|
|
||||||
// ---- setters (toute action utilisateur revient page 1) ----
|
|
||||||
function setSort(key: string): void {
|
|
||||||
if (sortKey.value === key) {
|
|
||||||
sortDir.value = sortDir.value === 'asc' ? 'desc' : 'asc';
|
|
||||||
} else {
|
|
||||||
sortKey.value = key;
|
|
||||||
sortDir.value = sortDefs.find((s) => s.key === key)?.defaultDir ?? 'asc';
|
|
||||||
}
|
|
||||||
page.value = 1;
|
|
||||||
}
|
|
||||||
function toggleFilter(key: string, value: string): void {
|
|
||||||
const next = { ...filters.value };
|
|
||||||
const set = new Set(next[key] ?? []);
|
|
||||||
if (set.has(value)) set.delete(value);
|
|
||||||
else set.add(value);
|
|
||||||
if (set.size === 0) delete next[key];
|
|
||||||
else next[key] = set;
|
|
||||||
filters.value = next;
|
|
||||||
page.value = 1;
|
|
||||||
}
|
|
||||||
function clearAll(): void {
|
|
||||||
search.value = '';
|
|
||||||
filters.value = {};
|
|
||||||
page.value = 1;
|
|
||||||
}
|
|
||||||
function setPage(p: number): void {
|
|
||||||
page.value = Math.min(Math.max(1, p), pageCount.value);
|
|
||||||
}
|
|
||||||
function setPageSize(n: number): void {
|
|
||||||
pageSize.value = n;
|
|
||||||
page.value = 1;
|
|
||||||
}
|
|
||||||
// saisie utilisateur : retour page 1 de façon synchrone (l'hydratation URL écrit search.value
|
|
||||||
// directement, sans passer par ici → ne réinitialise pas une page fournie par l'URL).
|
|
||||||
function setSearch(v: string): void {
|
|
||||||
search.value = v;
|
|
||||||
page.value = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// suspend l'écriture état→URL pendant l'application des params depuis l'URL.
|
|
||||||
let hydrating = false;
|
|
||||||
|
|
||||||
// ---- synchro URL (optionnelle) ----
|
|
||||||
if (opts.urlKey) {
|
|
||||||
const k = opts.urlKey;
|
|
||||||
const P = {
|
|
||||||
q: `${k}_q`,
|
|
||||||
sort: `${k}_sort`,
|
|
||||||
dir: `${k}_dir`,
|
|
||||||
filter: `${k}_filter`,
|
|
||||||
page: `${k}_page`,
|
|
||||||
size: `${k}_size`,
|
|
||||||
};
|
|
||||||
const route = useRoute();
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
// sérialise les filtres de façon canonique : key:v1,v2;key2:v3 (clés/valeurs triées).
|
|
||||||
const serializeFilters = (f: Record<string, Set<string>>): string =>
|
|
||||||
Object.entries(f)
|
|
||||||
.filter(([, set]) => set.size > 0)
|
|
||||||
.sort(([a], [b]) => a.localeCompare(b))
|
|
||||||
.map(([key, set]) => `${key}:${[...set].sort().join(',')}`)
|
|
||||||
.join(';');
|
|
||||||
|
|
||||||
// params possédés par cette liste (non-défauts uniquement → URLs propres).
|
|
||||||
function ownedParams(): Record<string, string> {
|
|
||||||
const out: Record<string, string> = {};
|
|
||||||
if (search.value.trim()) out[P.q] = search.value.trim();
|
|
||||||
if (sortKey.value !== defaultSortKey) out[P.sort] = sortKey.value;
|
|
||||||
const baseDir = sortDefs.find((s) => s.key === sortKey.value)?.defaultDir ?? 'asc';
|
|
||||||
if (sortDir.value !== baseDir) out[P.dir] = sortDir.value;
|
|
||||||
const fser = serializeFilters(filters.value);
|
|
||||||
if (fser) out[P.filter] = fser;
|
|
||||||
if (page.value > 1) out[P.page] = String(page.value);
|
|
||||||
if (pageSize.value !== defaultPageSize) out[P.size] = String(pageSize.value);
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
const canonical = (o: Record<string, string>): string =>
|
|
||||||
Object.keys(o).sort().map((key) => `${key}=${o[key]}`).join('&');
|
|
||||||
|
|
||||||
function readOwned(query: Record<string, unknown>): Record<string, string> {
|
|
||||||
const out: Record<string, string> = {};
|
|
||||||
for (const key of Object.values(P)) {
|
|
||||||
const v = query[key];
|
|
||||||
if (typeof v === 'string' && v) out[key] = v;
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyFromQuery(query: Record<string, unknown>): void {
|
|
||||||
hydrating = true;
|
|
||||||
const str = (key: string): string => (typeof query[key] === 'string' ? (query[key] as string) : '');
|
|
||||||
search.value = str(P.q);
|
|
||||||
sortKey.value = sortDefs.some((s) => s.key === str(P.sort)) ? str(P.sort) : defaultSortKey;
|
|
||||||
const dir = str(P.dir);
|
|
||||||
sortDir.value = dir === 'asc' || dir === 'desc' ? dir : sortDefs.find((s) => s.key === sortKey.value)?.defaultDir ?? 'asc';
|
|
||||||
const parsedFilters: Record<string, Set<string>> = {};
|
|
||||||
const fser = str(P.filter);
|
|
||||||
if (fser) {
|
|
||||||
for (const part of fser.split(';')) {
|
|
||||||
const [fk, vals] = part.split(':');
|
|
||||||
if (!fk || !vals) continue;
|
|
||||||
const def = filterDefs.value.find((d) => d.key === fk);
|
|
||||||
if (!def) continue;
|
|
||||||
const allowed = new Set(def.options.map((o) => o.value));
|
|
||||||
const set = new Set(vals.split(',').filter((v) => allowed.has(v)));
|
|
||||||
if (set.size) parsedFilters[fk] = set;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filters.value = parsedFilters;
|
|
||||||
const sz = Number(str(P.size));
|
|
||||||
pageSize.value = Number.isFinite(sz) && sz >= 0 ? sz : defaultPageSize;
|
|
||||||
const pg = Number(str(P.page));
|
|
||||||
page.value = Number.isFinite(pg) && pg >= 1 ? pg : 1;
|
|
||||||
// libère le garde après le flush des watchers déclenchés par les assignations ci-dessus.
|
|
||||||
void Promise.resolve().then(() => {
|
|
||||||
hydrating = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// URL → état (init + navigations arrière/avant) ; ignore si déjà en phase avec l'état courant.
|
|
||||||
watch(
|
|
||||||
() => route.query,
|
|
||||||
(query) => {
|
|
||||||
if (canonical(readOwned(query)) === canonical(ownedParams())) return;
|
|
||||||
applyFromQuery(query);
|
|
||||||
},
|
|
||||||
{ immediate: true, deep: true },
|
|
||||||
);
|
|
||||||
|
|
||||||
// état → URL : remplace (pas d'entrée d'historique), préserve les params non possédés.
|
|
||||||
watch(
|
|
||||||
[search, sortKey, sortDir, filters, page, pageSize],
|
|
||||||
() => {
|
|
||||||
if (hydrating) return;
|
|
||||||
const owned = ownedParams();
|
|
||||||
const preserved: Record<string, unknown> = {};
|
|
||||||
for (const [key, v] of Object.entries(route.query)) {
|
|
||||||
if (!Object.values(P).includes(key)) preserved[key] = v;
|
|
||||||
}
|
|
||||||
const next = { ...preserved, ...owned };
|
|
||||||
// no-op si la query possédée est inchangée (anti-boucle / anti-spam).
|
|
||||||
if (canonical(readOwned(route.query)) === canonical(owned)) return;
|
|
||||||
void router.replace({ query: next as Record<string, string> });
|
|
||||||
},
|
|
||||||
{ deep: true },
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
search,
|
|
||||||
sortKey,
|
|
||||||
sortDir,
|
|
||||||
filters,
|
|
||||||
page,
|
|
||||||
pageSize,
|
|
||||||
processed,
|
|
||||||
total,
|
|
||||||
pageCount,
|
|
||||||
activeFilterCount,
|
|
||||||
setSearch,
|
|
||||||
setSort,
|
|
||||||
toggleFilter,
|
|
||||||
clearAll,
|
|
||||||
setPage,
|
|
||||||
setPageSize,
|
|
||||||
sortDefs,
|
|
||||||
filterDefs,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
import { computed, type Component } from 'vue';
|
|
||||||
import { useRoute, type RouteLocationRaw } from 'vue-router';
|
|
||||||
import { useI18n } from 'vue-i18n';
|
|
||||||
import { Boxes, GitBranch, LifeBuoy, Settings, TerminalSquare } from '@lucide/vue';
|
|
||||||
import { useSessionsStore } from '../stores/sessions';
|
|
||||||
import { useSettingsStore } from '../stores/settings';
|
|
||||||
import GiteaIcon from '../components/ui/GiteaIcon.vue';
|
|
||||||
|
|
||||||
export interface NavEntry {
|
|
||||||
key: string;
|
|
||||||
/** route interne (exclusif avec `href`). */
|
|
||||||
to?: RouteLocationRaw;
|
|
||||||
/** lien externe ouvert dans un nouvel onglet (exclusif avec `to`). */
|
|
||||||
href?: string;
|
|
||||||
icon: Component;
|
|
||||||
label: string;
|
|
||||||
match: string[]; // noms de routes considérés actifs pour cet item
|
|
||||||
badge: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Définition unique de la navigation, partagée par la sidebar et la barre d'onglets. */
|
|
||||||
export function useNav() {
|
|
||||||
const { t } = useI18n();
|
|
||||||
const route = useRoute();
|
|
||||||
const sessions = useSessionsStore();
|
|
||||||
const settings = useSettingsStore();
|
|
||||||
|
|
||||||
// sessions vivantes bloquées sur un dialogue (le cœur de la supervision mobile).
|
|
||||||
const waitingCount = computed(
|
|
||||||
() => sessions.sessions.filter((s) => s.live && s.activity === 'waiting').length,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Onglets principaux : barre du bas mobile + haut de sidebar.
|
|
||||||
const primary = computed<NavEntry[]>(() => [
|
|
||||||
{ key: 'worktrees', to: { name: 'dashboard' }, icon: GitBranch, label: t('nav.worktrees'), match: ['dashboard'], badge: 0 },
|
|
||||||
{ key: 'sessions', to: { name: 'sessions' }, icon: TerminalSquare, label: t('nav.sessions'), match: ['sessions', 'session'], badge: waitingCount.value },
|
|
||||||
{ key: 'groups', to: { name: 'groups' }, icon: Boxes, label: t('nav.groups'), match: ['groups', 'group'], badge: 0 },
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Onglets secondaires : réglages, aide, et lien externe Gitea (uniquement si l'URL est configurée).
|
|
||||||
const secondary = computed<NavEntry[]>(() => {
|
|
||||||
const items: NavEntry[] = [
|
|
||||||
{ key: 'settings', to: { name: 'settings' }, icon: Settings, label: t('nav.settings'), match: ['settings'], badge: 0 },
|
|
||||||
{ key: 'help', to: { name: 'help' }, icon: LifeBuoy, label: t('nav.help'), match: ['help'], badge: 0 },
|
|
||||||
];
|
|
||||||
if (settings.giteaUrl) {
|
|
||||||
items.push({ key: 'gitea', href: settings.giteaUrl, icon: GiteaIcon, label: t('nav.gitea'), match: [], badge: 0 });
|
|
||||||
}
|
|
||||||
return items;
|
|
||||||
});
|
|
||||||
|
|
||||||
const isActive = (match: string[]): boolean => match.includes(String(route.name));
|
|
||||||
|
|
||||||
return { primary, secondary, isActive, waitingCount };
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
import { useRouter } from 'vue-router';
|
|
||||||
import { useAuthStore } from '../stores/auth';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Déconnexion centralisée. `auth.logout()` ferme la WebSocket ; la redirection vers /login
|
|
||||||
* démonte l'AppShell, qui stoppe alors les abonnements temps réel (source unique). Corrige
|
|
||||||
* l'incohérence où certaines vues ne stoppaient pas tous les flux au logout.
|
|
||||||
*/
|
|
||||||
export function useSession() {
|
|
||||||
const auth = useAuthStore();
|
|
||||||
const router = useRouter();
|
|
||||||
|
|
||||||
async function logout(): Promise<void> {
|
|
||||||
await auth.logout();
|
|
||||||
await router.replace({ name: 'login' });
|
|
||||||
}
|
|
||||||
|
|
||||||
return { logout };
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
import { computed, ref } from 'vue';
|
|
||||||
import type { WorktreeSummary } from '@arboretum/shared';
|
|
||||||
import type { ListToolbarControls, SortDir } from './useListControls';
|
|
||||||
import { useDebouncedRef } from './useDebouncedRef';
|
|
||||||
import { worktreeSorts, worktreeFilters } from './listDefs';
|
|
||||||
import { useWorktreesStore } from '../stores/worktrees';
|
|
||||||
|
|
||||||
export interface WorktreeView extends ListToolbarControls<WorktreeSummary> {
|
|
||||||
apply: (list: readonly WorktreeSummary[]) => WorktreeSummary[];
|
|
||||||
isActive: () => boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* État de tri/filtre/recherche des worktrees, PARTAGÉ entre toutes les RepoSection du dashboard
|
|
||||||
* (une seule toolbar pilote toutes les sections). Singleton module-level — et non un store Pinia,
|
|
||||||
* car Pinia déballe les refs, ce que ListToolbar attend justement comme refs. Pas de pagination
|
|
||||||
* (liste groupée par repo) ; `apply()` filtre+trie le sous-ensemble d'un repo donné.
|
|
||||||
*/
|
|
||||||
let instance: WorktreeView | null = null;
|
|
||||||
|
|
||||||
function create(): WorktreeView {
|
|
||||||
const search = ref('');
|
|
||||||
const debounced = useDebouncedRef(search, 150);
|
|
||||||
const sortKey = ref('main');
|
|
||||||
const sortDir = ref<SortDir>('asc');
|
|
||||||
const filters = ref<Record<string, Set<string>>>({});
|
|
||||||
|
|
||||||
const sortDefs = worktreeSorts();
|
|
||||||
const filterDefList = worktreeFilters();
|
|
||||||
const filterDefs = computed(() => filterDefList);
|
|
||||||
|
|
||||||
const accessor = (w: WorktreeSummary): string => `${w.branch ?? ''} ${w.path}`.toLowerCase();
|
|
||||||
|
|
||||||
function apply(list: readonly WorktreeSummary[]): WorktreeSummary[] {
|
|
||||||
let items = [...list];
|
|
||||||
for (const def of filterDefList) {
|
|
||||||
const active = filters.value[def.key];
|
|
||||||
if (active && active.size > 0) items = items.filter((it) => def.predicate(it, active));
|
|
||||||
}
|
|
||||||
const q = debounced.value.trim().toLowerCase();
|
|
||||||
if (q) items = items.filter((w) => accessor(w).includes(q));
|
|
||||||
const def = sortDefs.find((s) => s.key === sortKey.value) ?? sortDefs[0];
|
|
||||||
if (def) {
|
|
||||||
const dir = sortDir.value === 'desc' ? -1 : 1;
|
|
||||||
items.sort((a, b) => def.compare(a, b) * dir);
|
|
||||||
}
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
|
|
||||||
const isActive = (): boolean => debounced.value.trim() !== '' || Object.keys(filters.value).length > 0;
|
|
||||||
|
|
||||||
// total (compteur de la toolbar) : worktrees correspondants, tous repos confondus.
|
|
||||||
const total = computed(() => apply(useWorktreesStore().worktrees).length);
|
|
||||||
const activeFilterCount = computed(() =>
|
|
||||||
Object.values(filters.value).reduce((n, set) => n + set.size, 0),
|
|
||||||
);
|
|
||||||
|
|
||||||
function setSearch(v: string): void {
|
|
||||||
search.value = v;
|
|
||||||
}
|
|
||||||
function setSort(key: string): void {
|
|
||||||
if (sortKey.value === key) sortDir.value = sortDir.value === 'asc' ? 'desc' : 'asc';
|
|
||||||
else {
|
|
||||||
sortKey.value = key;
|
|
||||||
sortDir.value = sortDefs.find((s) => s.key === key)?.defaultDir ?? 'asc';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function toggleFilter(key: string, value: string): void {
|
|
||||||
const next = { ...filters.value };
|
|
||||||
const set = new Set(next[key] ?? []);
|
|
||||||
if (set.has(value)) set.delete(value);
|
|
||||||
else set.add(value);
|
|
||||||
if (set.size === 0) delete next[key];
|
|
||||||
else next[key] = set;
|
|
||||||
filters.value = next;
|
|
||||||
}
|
|
||||||
function clearAll(): void {
|
|
||||||
search.value = '';
|
|
||||||
filters.value = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
search,
|
|
||||||
sortKey,
|
|
||||||
sortDir,
|
|
||||||
filters,
|
|
||||||
total,
|
|
||||||
activeFilterCount,
|
|
||||||
setSearch,
|
|
||||||
setSort,
|
|
||||||
toggleFilter,
|
|
||||||
clearAll,
|
|
||||||
sortDefs,
|
|
||||||
filterDefs,
|
|
||||||
apply,
|
|
||||||
isActive,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export function useWorktreeView(): WorktreeView {
|
|
||||||
instance ??= create();
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||