Compare commits
@@ -1,55 +0,0 @@
|
||||
name: Deploy site (production)
|
||||
|
||||
# Déploie le site vitrine (packages/site) sur Plesk via FTPS (lftp), à l'identique
|
||||
# de lidge_web / tracksniff-web. Ne se déclenche que sur un changement du site.
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'packages/site/**'
|
||||
- '.gitea/workflows/prod.yml'
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: deploy-site
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: node:22-bookworm
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Install scopé au workspace du site : pas de build des deps natives du
|
||||
# serveur (node-pty / node:sqlite) qui n'ont rien à faire ici.
|
||||
- name: Install deps (@arboretum/site)
|
||||
run: npm install -w @arboretum/site --no-audit --no-fund
|
||||
|
||||
- name: Build site
|
||||
run: npm run build:site
|
||||
|
||||
- name: Check build output
|
||||
run: ls -la packages/site/dist
|
||||
|
||||
- name: Deploy via FTPS (lftp)
|
||||
run: |
|
||||
if [ -z "$REMOTE_PATH" ]; then
|
||||
echo "::error::Secret SITE_REMOTE_PATH manquant (chemin docroot du vhost git-arboretum.com)."
|
||||
exit 1
|
||||
fi
|
||||
apt-get update && apt-get install -y lftp
|
||||
lftp -c "
|
||||
open -u \"$FTP_USER\",\"$FTP_PASSWORD\" \"$FTP_HOST\"
|
||||
set ssl:verify-certificate no
|
||||
mirror -R --delete --verbose packages/site/dist \"$REMOTE_PATH\"
|
||||
"
|
||||
env:
|
||||
FTP_HOST: ${{ secrets.FTP_HOST }}
|
||||
FTP_USER: ${{ secrets.FTP_USER }}
|
||||
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
|
||||
# Chemin docroot du vhost git-arboretum.com sur Plesk (ex. /httpdocs/arboretum/public).
|
||||
REMOTE_PATH: ${{ secrets.SITE_REMOTE_PATH }}
|
||||
@@ -1,73 +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"
|
||||
# Publication idempotente : le signal faisant autorité d'une version déjà présente est le
|
||||
# 409 « already exists » renvoyé par npm publish lui-même (npm view est non fiable contre le
|
||||
# registre npm de Gitea — faux négatif masqué par >/dev/null). On tente toujours le publish ;
|
||||
# un 409 = succès idempotent, tout autre échec reste fatal. Le shell Actions tourne en
|
||||
# `bash -eo pipefail` : on isole l'échec attendu dans la condition d'un `if` pour ne pas
|
||||
# déclencher `set -e`. Le secret du registre est mappé sur NODE_AUTH_TOKEN lu par le .npmrc
|
||||
# de setup-node.
|
||||
- name: Publish (idempotent — tolère un 409 « already exists »)
|
||||
run: |
|
||||
if out="$(npm publish -w @johanleroy/git-arboretum 2>&1)"; then
|
||||
printf '%s\n' "$out"
|
||||
echo "Publication réussie."
|
||||
else
|
||||
code=$?
|
||||
printf '%s\n' "$out"
|
||||
if printf '%s' "$out" | grep -qiE 'E409|409 Conflict|already exists'; then
|
||||
echo "::notice::Version déjà présente sur le registre (409) — publication idempotente, étape ignorée."
|
||||
else
|
||||
echo "::error::Échec de la publication (code $code)."
|
||||
exit "$code"
|
||||
fi
|
||||
fi
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
# SBOM (transparence supply-chain entreprise) : généré pour le paquet publié et exposé en
|
||||
# artefact. C'est un bonus : un échec de génération/upload ne doit jamais faire rougir une
|
||||
# release dont le publish a réussi → continue-on-error.
|
||||
# upload-artifact@v3 : Gitea Actions (GHES-like) ne supporte pas @v4 (@actions/artifact v2+).
|
||||
- name: Generate SBOM (CycloneDX)
|
||||
continue-on-error: true
|
||||
run: npx --yes @cyclonedx/cyclonedx-npm --omit dev --output-format JSON --output-file sbom.json -w @johanleroy/git-arboretum || npx --yes @cyclonedx/cyclonedx-npm --omit dev --output-format JSON --output-file sbom.json
|
||||
- uses: actions/upload-artifact@v3
|
||||
continue-on-error: true
|
||||
with:
|
||||
name: sbom
|
||||
path: sbom.json
|
||||
@@ -27,7 +27,6 @@ jobs:
|
||||
- run: npm ci
|
||||
- run: npm run typecheck
|
||||
- run: npm run build
|
||||
- run: npm run build:site
|
||||
- run: npx vitest run
|
||||
|
||||
pack-smoke:
|
||||
@@ -42,27 +41,14 @@ jobs:
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
# @arboretum/shared (paquet workspace NON publié) est INLINÉ dans dist/_shared au prepack
|
||||
# (scripts/inline-shared.mjs) : le tarball est 100 % autonome — aucun node_modules embarqué,
|
||||
# aucune bundleDependency, aucun symlink. On packe en mode workspace (-w), EXACTEMENT comme
|
||||
# le fait « npm publish » dans release.yml, puis on l'installe seul comme un vrai consommateur.
|
||||
- name: Pack tarball
|
||||
# @arboretum/shared est une dépendance runtime non publiée : on packe les
|
||||
# deux tarballs et on les installe ensemble dans un projet vierge.
|
||||
- name: Pack tarballs
|
||||
run: |
|
||||
rm -rf /tmp/tarballs && mkdir -p /tmp/tarballs
|
||||
npm pack -w @johanleroy/git-arboretum --pack-destination /tmp/tarballs
|
||||
mkdir -p /tmp/tarballs
|
||||
npm pack -w @arboretum/shared -w git-arboretum --pack-destination /tmp/tarballs
|
||||
ls -l /tmp/tarballs
|
||||
- name: Assert the package is self-contained (@arboretum/shared inlined)
|
||||
run: |
|
||||
tgz=$(ls /tmp/tarballs/*.tgz)
|
||||
rm -rf /tmp/inspect && mkdir -p /tmp/inspect && tar -xzf "$tgz" -C /tmp/inspect
|
||||
test -f /tmp/inspect/package/dist/_shared/index.js \
|
||||
|| { echo "ERREUR: dist/_shared/index.js absent de $tgz — inline-shared n'a pas tourné ?"; exit 1; }
|
||||
if grep -rq '@arboretum/shared' /tmp/inspect/package/dist; then
|
||||
echo "ERREUR: import bare '@arboretum/shared' encore présent dans le JS publié"
|
||||
grep -rn '@arboretum/shared' /tmp/inspect/package/dist; exit 1
|
||||
fi
|
||||
echo "OK: paquet autonome — shared inliné dans dist/_shared, aucun import externe"
|
||||
- name: Install tarball in an empty project
|
||||
- name: Install tarballs in an empty project
|
||||
run: |
|
||||
mkdir /tmp/smoke
|
||||
cd /tmp/smoke
|
||||
@@ -5,11 +5,6 @@ node_modules/
|
||||
dist/
|
||||
packages/server/public/
|
||||
*.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
|
||||
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,266 +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, le démarrage de sessions sur votre branche principale ou n'importe quel worktree, les états de session en temps réel, le terminal web, la supervision mobile (PWA installable, Web Push quand une session vous attend, répondre à une demande sans ouvrir de terminal) et les groupes de travail (piloter plusieurs repos liés depuis une seule session Claude) 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 ; répondez à une demande (ses options, ou refusez) sans ouvrir de terminal.
|
||||
- **Groupes de travail** — regroupez des repos liés (ex. une API, son frontend web et sa doc) dans un groupe nommé, puis lancez **une seule session Claude qui les couvre tous à la fois** (via le flag `--add-dir` du CLI) : une conversation unique avec un contexte partagé travaillant à travers chaque repo, plus une vue unifiée de tous leurs worktrees et une grille multi-terminaux côte à côte. Une session de groupe peut d'abord créer le même worktree de branche dans chaque repo, ou tourner directement sur les checkouts principaux.
|
||||
|
||||
---
|
||||
|
||||
## 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 la branche principale du repo ou n'importe quel 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. Répondez à la demande — choisissez l'une de ses options ou refusez-la — directement depuis le dashboard, 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.
|
||||
- Envoie des en-têtes HTTP durcis (CSP, `X-Frame-Options`, `nosniff`, `Referrer-Policy`, HSTS conditionnel, `no-store` sur l'API), restreint le dossier de données à `0o700` et la base à `0o600`, et **chiffre les secrets sensibles au repos** (AES-256-GCM).
|
||||
- Tient un **journal d'audit** des opérations sensibles et offre l'**export/effacement RGPD** des données (Réglages → Sécurité & conformité).
|
||||
|
||||
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.
|
||||
|
||||
Voir [`SECURITY.md`](SECURITY.md) pour le modèle de menace complet et [`docs/ENTERPRISE_DEPLOYMENT.md`](docs/ENTERPRISE_DEPLOYMENT.md) pour le durcissement en environnement réglementé.
|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
## Soutenir le projet
|
||||
|
||||
Arboretum est un projet personnel libre et auto-financé. S'il vous fait gagner du temps, vous pouvez soutenir son développement :
|
||||
|
||||
[](https://buymeacoffee.com/johanleroy)
|
||||
|
||||
## Licence
|
||||
|
||||
MIT — voir [LICENSE](LICENSE).
|
||||
@@ -1,16 +1,8 @@
|
||||
<p align="center">
|
||||
<img src="brand/arboretum-logo-on-dark.png" alt="Arboretum" width="300">
|
||||
</p>
|
||||
# Arboretum
|
||||
|
||||
<p align="center">
|
||||
A self-hosted web dashboard for your git worktrees and the Claude Code sessions running on them — from any device.
|
||||
</p>
|
||||
> A self-hosted web dashboard for your git worktrees and the Claude Code sessions running on them — from any device.
|
||||
|
||||
<p align="center">
|
||||
<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, sessions on your main branch or any worktree, live session states, the web terminal, mobile supervision (installable PWA, Web Push when a session needs you, answer a prompt without opening a terminal), and work groups (drive several related repos from a single Claude session) are implemented and tested.
|
||||
**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.
|
||||
|
||||
---
|
||||
|
||||
@@ -24,14 +16,13 @@ Working with AI coding agents changed how we use git: one feature = one worktree
|
||||
|
||||
## 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).
|
||||
- **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.
|
||||
- **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; answer a prompt (its options, or deny) without opening a terminal.
|
||||
- **Work groups** — bundle related repos (e.g. an API, its web frontend and its docs) into a named group, then launch **one Claude session that spans all of them at once** (via the CLI's `--add-dir`): a single conversation with one shared context working across every repo, plus a unified view of all their worktrees and a side-by-side multi-terminal grid. Group sessions can either create the same branch worktree in each repo first, or run straight on the main checkouts.
|
||||
- **Supervision from your phone** — installable PWA with push notifications when a session needs you; approve/deny a prompt without opening a terminal.
|
||||
|
||||
---
|
||||
|
||||
@@ -43,23 +34,10 @@ A single Node.js daemon you run on your dev machine (`npx @johanleroy/git-arbore
|
||||
|
||||
## 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)
|
||||
|
||||
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
|
||||
npx @johanleroy/git-arboretum
|
||||
npx git-arboretum
|
||||
```
|
||||
|
||||
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**.
|
||||
|
||||
`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
|
||||
|
||||
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
|
||||
git clone https://git.lidge.fr/johanleroy/arboretum.git
|
||||
cd arboretum
|
||||
@@ -100,9 +69,9 @@ node packages/server/dist/index.js
|
||||
|
||||
1. **Add a repository.** From the dashboard, register a local git repo by its path. Optionally configure **post-create hooks** (e.g. `npm ci`, `cp ../.env .env`) that run automatically every time you create a new worktree for that repo.
|
||||
2. **Create or adopt worktrees.** Spin up a new worktree + branch in one click (hooks run for you), or adopt a worktree you created by hand. Each worktree shows its branch, ahead/behind, and dirty-file count.
|
||||
3. **Start or resume a session.** Launch a Claude Code session on the repo's main branch or any worktree, or resume one that was started in your terminal — Arboretum discovers existing sessions automatically and always resumes them in their original working directory.
|
||||
3. **Start or resume a session.** Launch a Claude Code session on a worktree, or resume one that was started in your terminal — Arboretum discovers existing sessions automatically and always resumes them in their original working directory.
|
||||
4. **Watch the live states.** Each session reports whether it's *busy*, *waiting for your input*, or *idle*. Open the **web terminal** to interact directly; it survives browser disconnects (closing the tab does not kill the session).
|
||||
5. **Supervise from your phone.** Install the PWA, and when a session flips to *waiting* you get a push notification. Answer the prompt — pick one of its options or deny it — straight from the dashboard, no terminal required.
|
||||
5. **Supervise from your phone.** Install the PWA, and when a session flips to *waiting* you get a push notification. Approve or deny the prompt straight from the notification UI — no terminal required.
|
||||
|
||||
## Remote access from your phone
|
||||
|
||||
@@ -116,70 +85,16 @@ tailscale serve --bg 7317
|
||||
Then start Arboretum allowing your tailnet origin (the strict Origin check needs to know about it):
|
||||
|
||||
```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.
|
||||
|
||||
> ⚠️ 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
|
||||
|
||||
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.
|
||||
|
||||
Daemon options are CLI flags:
|
||||
All options are CLI flags:
|
||||
|
||||
| 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). |
|
||||
| `--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`).
|
||||
|
||||
## Security model
|
||||
@@ -208,13 +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.
|
||||
- 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.
|
||||
- Sends hardened HTTP headers (CSP, `X-Frame-Options`, `nosniff`, `Referrer-Policy`, conditional HSTS, `no-store` on the API), restricts the data directory to `0o700` and the database to `0o600`, and **encrypts sensitive secrets at rest** (AES-256-GCM).
|
||||
- Keeps an **audit log** of sensitive operations and offers **GDPR** data export/erasure (Settings → Security & compliance).
|
||||
- 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.
|
||||
|
||||
See [`SECURITY.md`](SECURITY.md) for the full threat model and [`docs/ENTERPRISE_DEPLOYMENT.md`](docs/ENTERPRISE_DEPLOYMENT.md) for hardening in regulated environments.
|
||||
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
|
||||
|
||||
@@ -235,7 +137,7 @@ Arboretum wraps the **interactive** Claude Code CLI in a PTY — the same thing
|
||||
|
||||
## 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
|
||||
npm run build # build shared → server → web (order matters)
|
||||
@@ -252,15 +154,8 @@ 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-p3.mjs # worktrees & session correlation
|
||||
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
|
||||
```
|
||||
|
||||
## Support
|
||||
|
||||
Arboretum is a free, self-funded side project. If it saves you time, you can support its development:
|
||||
|
||||
[](https://buymeacoffee.com/johanleroy)
|
||||
|
||||
## License
|
||||
|
||||
MIT — see [LICENSE](LICENSE).
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
# Security Policy
|
||||
|
||||
Arboretum is a self-hosted daemon that serves a web dashboard to drive git worktrees and the
|
||||
Claude Code sessions running on them. **A web terminal is remote code execution by design** — that
|
||||
is the product, not a bug. Arboretum's security model is therefore built on *structural* guards
|
||||
(loopback-only binding, authenticated access, strict Origin checks) far more than on cryptography
|
||||
alone.
|
||||
|
||||
This document describes the threat model, the controls that are implemented, the deliberate
|
||||
trade-offs, and how to report a vulnerability. For hardening a deployment in a regulated
|
||||
environment, see [`docs/ENTERPRISE_DEPLOYMENT.md`](docs/ENTERPRISE_DEPLOYMENT.md).
|
||||
|
||||
## Threat model
|
||||
|
||||
- **Single-user by design.** Arboretum runs on the owner's machine and is meant for one operator.
|
||||
There is no multi-tenant isolation and no RBAC — and none is claimed.
|
||||
- **Loopback by default.** The server binds `127.0.0.1`; `config.ts` *refuses* any non-loopback bind
|
||||
unless you pass `--i-know-this-exposes-a-terminal`. Remote access is expected via **Tailscale Serve**
|
||||
(TLS + tailnet identity), never by opening a port.
|
||||
- **The terminal is RCE.** Anyone who can authenticate can run code. The controls below exist to make
|
||||
sure only the authenticated operator reaches it, and that the surrounding surface (cookies, headers,
|
||||
data at rest) is hardened.
|
||||
|
||||
## Implemented controls
|
||||
|
||||
| Area | Control | Where |
|
||||
| --- | --- | --- |
|
||||
| Network | Loopback-only default; non-loopback refused without explicit flag | `packages/server/src/config.ts` |
|
||||
| AuthN | Global guard on **all** `/api/**` and `/ws` (only login is public, and rate-limited) | `packages/server/src/app.ts` |
|
||||
| AuthN | Tokens stored **hashed** (SHA-256), compared in constant time; bootstrap token shown once | `packages/server/src/auth/service.ts` |
|
||||
| Sessions | Cookie is an HMAC-SHA256 signed payload, `HttpOnly` + `SameSite=Strict`, `Secure` when HTTPS | `packages/server/src/routes/auth.ts` |
|
||||
| CSRF / WS | Strict `Origin` check on every `/api/**` and `/ws` request (anti cross-site WS hijacking) | `packages/server/src/app.ts` |
|
||||
| CSRF | Mutations carrying a body must be `application/json` | `packages/server/src/app.ts` |
|
||||
| Rate limit | Global login rate limit with exponential backoff (not per-IP — Tailscale fronts everything as 127.0.0.1) | `packages/server/src/auth/service.ts` |
|
||||
| HTTP headers | CSP, `X-Frame-Options: DENY`, `X-Content-Type-Options: nosniff`, `Referrer-Policy`, `Permissions-Policy`, conditional HSTS, `Cache-Control: no-store` on API; `Server` header stripped | `packages/server/src/app.ts` |
|
||||
| Injection | All SQL is parameterized; all git calls use `execFile` (no shell); path-traversal guards | `packages/server/src/**` |
|
||||
| Data at rest | DB file/dir forced to `0o600`/`0o700`; sensitive secrets (server secret, VAPID private key) encrypted with AES-256-GCM | `packages/server/src/db/index.ts`, `core/secret-box.ts` |
|
||||
| Audit | Persistent audit log of sensitive mutations (tokens, settings, secrets, push, groups) | `packages/server/src/core/audit-log.ts` |
|
||||
| Privacy | GDPR export (`/api/v1/data/export`) and erasure (`/api/v1/data/delete-my-data`) | `packages/server/src/routes/data.ts` |
|
||||
| Install | Runs as a **user** service (systemd user unit / launchd LaunchAgent), never root | `packages/server/src/cli/install.ts` |
|
||||
|
||||
## Deliberate trade-offs
|
||||
|
||||
- **Long-lived API tokens.** Tokens do not expire by age (CLI automation stability) but can be revoked
|
||||
instantly, and `last_used_at` is tracked. Review and rotate tokens periodically.
|
||||
- **Encryption-at-rest key management.** With no `ARBORETUM_SECRET_KEY` set, the encryption key lives in
|
||||
`dataDir/secret.key` (`0o600`) next to the database — this protects a leaked database *copy* (backup,
|
||||
WAL) but not a full `dataDir` compromise. For strong protection, set `ARBORETUM_SECRET_KEY` and store it
|
||||
separately from database backups. Full-DB SQLCipher is intentionally avoided (it breaks the `npx`
|
||||
prebuilt portability).
|
||||
- **No multi-user model.** If you need multiple operators with isolation, Arboretum is not the right tool.
|
||||
|
||||
## Reporting a vulnerability
|
||||
|
||||
Please report security issues **privately** — do not open a public issue.
|
||||
|
||||
- Email: **security@johanleroy.fr** (or `contact@johanleroy.fr`).
|
||||
- Include a description, affected version, and reproduction steps.
|
||||
- Expect an acknowledgement within **7 days** and a coordinated disclosure window of up to **90 days**.
|
||||
|
||||
Thank you for helping keep Arboretum users safe.
|
||||
@@ -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()
|
||||
@@ -1,95 +0,0 @@
|
||||
# Enterprise deployment guide
|
||||
|
||||
This guide complements [`../SECURITY.md`](../SECURITY.md) with the operational steps a regulated or
|
||||
security-conscious organization needs to deploy Arboretum with confidence.
|
||||
|
||||
## 1. Remote access: Tailscale Serve (recommended)
|
||||
|
||||
Never open a public port. Keep the default `127.0.0.1` bind and put Arboretum behind Tailscale Serve:
|
||||
|
||||
```bash
|
||||
# on the host running arboretum (default bind 127.0.0.1:7317)
|
||||
tailscale serve --bg 7317
|
||||
```
|
||||
|
||||
This gives you TLS, a stable `*.ts.net` hostname, and tailnet identity. Then add that origin to the
|
||||
allow-list so the strict Origin check accepts it:
|
||||
|
||||
```bash
|
||||
arboretum --allow-origin https://my-host.tailnet.ts.net
|
||||
```
|
||||
|
||||
The `--i-know-this-exposes-a-terminal` flag exists only as an escape hatch for non-loopback binds; it
|
||||
is **never** a deployment mode and is never injected automatically by `arboretum install`.
|
||||
|
||||
## 2. Encryption at rest
|
||||
|
||||
Sensitive secrets (the HMAC server secret and the VAPID private key) are encrypted with AES-256-GCM
|
||||
before being stored in SQLite. Token values are never stored — only their SHA-256 hashes.
|
||||
|
||||
For **strong** protection (key not co-located with the database), provide a passphrase via the
|
||||
environment instead of the on-disk key file:
|
||||
|
||||
```bash
|
||||
ARBORETUM_SECRET_KEY='<a long random passphrase from your secrets manager>' arboretum
|
||||
```
|
||||
|
||||
- Store this passphrase in your secrets manager / KMS, **separately** from database backups.
|
||||
- Without it, the key is auto-generated in `dataDir/secret.key` (`0o600`). This still protects a leaked
|
||||
database copy, but not a full `dataDir` compromise.
|
||||
- Rotating the passphrase requires re-encrypting existing values; the simplest path is to revoke and
|
||||
recreate the bootstrap token after rotation.
|
||||
|
||||
## 3. Filesystem permissions
|
||||
|
||||
On startup Arboretum forces `dataDir` to `0o700` and the database files (`*.db`, `-wal`, `-shm`) to
|
||||
`0o600`. Verify after first run:
|
||||
|
||||
```bash
|
||||
stat -c '%a %n' ~/.local/share/arboretum ~/.local/share/arboretum/*.db
|
||||
# expect: 700 …/arboretum and 600 …/arboretum.db
|
||||
```
|
||||
|
||||
Keep `$HOME` private (standard `0o700`). If you relocate data with `--db` or `XDG_DATA_HOME`, make sure
|
||||
the target directory is not world-readable.
|
||||
|
||||
## 4. Audit logging
|
||||
|
||||
All sensitive mutations are recorded in an append-only `audit_logs` table: token create/revoke, login
|
||||
success/failure, settings changes, secret generation, push subscribe/unsubscribe, group CRUD, and data
|
||||
erasure. Query it via the API (paginated):
|
||||
|
||||
```bash
|
||||
curl -s -H "Authorization: Bearer $TOKEN" \
|
||||
'http://127.0.0.1:7317/api/v1/audit-logs?limit=100'
|
||||
```
|
||||
|
||||
The audit log never contains secret values — only non-sensitive metadata (ids, labels, counters). It is
|
||||
also visible in the dashboard under **Settings → Security & compliance**.
|
||||
|
||||
## 5. GDPR (data subject requests)
|
||||
|
||||
- **Export**: `GET /api/v1/data/export` returns every record tied to the authenticated token (token
|
||||
metadata, push subscriptions, session history, settings) as JSON. Also available as a one-click
|
||||
download in **Settings → Security & compliance**.
|
||||
- **Erasure**: `POST /api/v1/data/delete-my-data` is a two-step call — the first response returns a
|
||||
`confirm` code that must be POSTed back to execute. It purges the token's push subscriptions and
|
||||
revokes the token (unless it is the last active one).
|
||||
|
||||
## 6. Backups & retention
|
||||
|
||||
- Back up the SQLite database (`arboretum.db`) with the WAL checkpointed. Treat backups as sensitive.
|
||||
- If you use `ARBORETUM_SECRET_KEY`, back the key up **separately** — a database backup is useless (and
|
||||
safe) without it, which is the point.
|
||||
- Session history is retained until the database is reset. To start clean, stop the service and remove
|
||||
the database file.
|
||||
|
||||
## 7. Logging hygiene
|
||||
|
||||
The log level is controlled by `ARBORETUM_LOG` (default `info`). Do **not** run `debug`/`trace` in
|
||||
production: verbose levels may log request metadata. Keep `info` or higher.
|
||||
|
||||
## 8. Supply chain
|
||||
|
||||
Each published release ships with a CycloneDX SBOM (`sbom.json`) generated in CI, so you can scan the
|
||||
dependency tree for known vulnerabilities before deploying.
|
||||
@@ -23,10 +23,6 @@
|
||||
"resolved": "packages/shared",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@arboretum/site": {
|
||||
"resolved": "packages/site",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@arboretum/web": {
|
||||
"resolved": "packages/web",
|
||||
"link": true
|
||||
@@ -724,9 +720,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@fastify/static": {
|
||||
"version": "9.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@fastify/static/-/static-9.1.3.tgz",
|
||||
"integrity": "sha512-aXrYtsiryLhRxRNaxNqsn7FUISeb7rB9q4eHUPIot5aeQBLNahnz1m6thzm7JWC1poSGXS9XrX8DvuMivp2hkQ==",
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fastify/static/-/static-8.3.0.tgz",
|
||||
"integrity": "sha512-yKxviR5PH1OKNnisIzZKmgZSus0r2OZb8qCSbqmw34aolT4g3UlzYfeBRym+HJ1J471CR8e2ldNub4PubD1coA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@@ -741,10 +737,10 @@
|
||||
"dependencies": {
|
||||
"@fastify/accept-negotiator": "^2.0.0",
|
||||
"@fastify/send": "^4.0.0",
|
||||
"content-disposition": "^1.0.1",
|
||||
"content-disposition": "^0.5.4",
|
||||
"fastify-plugin": "^5.0.0",
|
||||
"fastq": "^1.17.1",
|
||||
"glob": "^13.0.0"
|
||||
"glob": "^11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fastify/websocket": {
|
||||
@@ -768,16 +764,6 @@
|
||||
"ws": "^8.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource/jetbrains-mono": {
|
||||
"version": "5.2.8",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource/jetbrains-mono/-/jetbrains-mono-5.2.8.tgz",
|
||||
"integrity": "sha512-6w8/SG4kqvIMu7xd7wt6x3idn1Qux3p9N62s6G3rfldOUYHpWcc2FKrqf+Vo44jRvqWj2oAtTHrZXEP23oSKwQ==",
|
||||
"dev": true,
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@homebridge/node-pty-prebuilt-multiarch": {
|
||||
"version": "0.13.1",
|
||||
"resolved": "https://registry.npmjs.org/@homebridge/node-pty-prebuilt-multiarch/-/node-pty-prebuilt-multiarch-0.13.1.tgz",
|
||||
@@ -853,9 +839,14 @@
|
||||
"url": "https://github.com/sponsors/kazupon"
|
||||
}
|
||||
},
|
||||
"node_modules/@johanleroy/git-arboretum": {
|
||||
"resolved": "packages/server",
|
||||
"link": true
|
||||
"node_modules/@isaacs/cliui": {
|
||||
"version": "9.0.0",
|
||||
"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": {
|
||||
"version": "0.3.13",
|
||||
@@ -919,15 +910,6 @@
|
||||
"@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": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@lukeed/ms/-/ms-2.0.2.tgz",
|
||||
@@ -2556,16 +2538,15 @@
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/content-disposition": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.1.0.tgz",
|
||||
"integrity": "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g==",
|
||||
"version": "0.5.4",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
"dependencies": {
|
||||
"safe-buffer": "5.2.1"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
"engines": {
|
||||
"node": ">= 0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
@@ -2596,6 +2577,20 @@
|
||||
"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": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||
@@ -2971,6 +2966,22 @@
|
||||
"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": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||
@@ -2992,6 +3003,10 @@
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/git-arboretum": {
|
||||
"resolved": "packages/server",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/github-from-package": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
||||
@@ -2999,17 +3014,24 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/glob": {
|
||||
"version": "13.0.6",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-13.0.6.tgz",
|
||||
"integrity": "sha512-Wjlyrolmm8uDpm/ogGyXZXb1Z+Ca2B8NbJwqBVg0axK9GbBeoS7yGV6vjXnYdGm6X53iehEuxxbyiKp8QmN4Vw==",
|
||||
"version": "11.1.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-11.1.0.tgz",
|
||||
"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",
|
||||
"dependencies": {
|
||||
"minimatch": "^10.2.2",
|
||||
"minipass": "^7.1.3",
|
||||
"path-scurry": "^2.0.2"
|
||||
"foreground-child": "^3.3.1",
|
||||
"jackspeak": "^4.1.1",
|
||||
"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": {
|
||||
"node": "18 || 20 || >=22"
|
||||
"node": "20 || >=22"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
@@ -3123,6 +3145,27 @@
|
||||
"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": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
|
||||
@@ -3668,6 +3711,12 @@
|
||||
"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": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz",
|
||||
@@ -3675,6 +3724,15 @@
|
||||
"dev": true,
|
||||
"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": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.2.tgz",
|
||||
@@ -4126,6 +4184,27 @@
|
||||
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
||||
"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": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
|
||||
@@ -4133,6 +4212,18 @@
|
||||
"dev": true,
|
||||
"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": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
|
||||
@@ -4808,6 +4899,21 @@
|
||||
"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": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
|
||||
@@ -4853,12 +4959,13 @@
|
||||
}
|
||||
},
|
||||
"packages/server": {
|
||||
"name": "@johanleroy/git-arboretum",
|
||||
"version": "1.6.0",
|
||||
"name": "git-arboretum",
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@arboretum/shared": "0.1.0",
|
||||
"@fastify/cookie": "^11.0.0",
|
||||
"@fastify/static": "^9.0.0",
|
||||
"@fastify/static": "^8.0.0",
|
||||
"@fastify/websocket": "^11.0.0",
|
||||
"@homebridge/node-pty-prebuilt-multiarch": "^0.13.0",
|
||||
"@xterm/headless": "^6.0.0",
|
||||
@@ -4869,123 +4976,22 @@
|
||||
"arboretum": "dist/index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arboretum/shared": "0.1.0",
|
||||
"@types/web-push": "^3.6.4",
|
||||
"@types/ws": "^8.5.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22.16"
|
||||
},
|
||||
"funding": {
|
||||
"type": "buymeacoffee",
|
||||
"url": "https://buymeacoffee.com/johanleroy"
|
||||
}
|
||||
},
|
||||
"packages/shared": {
|
||||
"name": "@arboretum/shared",
|
||||
"version": "0.1.0"
|
||||
},
|
||||
"packages/site": {
|
||||
"name": "@arboretum/site",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"vue": "^3.5.38",
|
||||
"vue-i18n": "^11.4.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fontsource/jetbrains-mono": "^5.1.0",
|
||||
"@tailwindcss/vite": "^4.3.0",
|
||||
"@vitejs/plugin-vue": "^6.0.7",
|
||||
"tailwindcss": "^4.3.0",
|
||||
"typescript": "^5.7.0",
|
||||
"vite": "^8.0.16",
|
||||
"vue-tsc": "^3.3.4"
|
||||
}
|
||||
},
|
||||
"packages/site/node_modules/vite": {
|
||||
"version": "8.0.16",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-8.0.16.tgz",
|
||||
"integrity": "sha512-h9bXPmJichP5fLmVQo3PyaGSDE2n3aPuomeAlVRm0JLmt4rY6zmPKd59HYI4LNW8oTK7tlTsuC7l/m7awx9Jcw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lightningcss": "^1.32.0",
|
||||
"picomatch": "^4.0.4",
|
||||
"postcss": "^8.5.15",
|
||||
"rolldown": "1.0.3",
|
||||
"tinyglobby": "^0.2.17"
|
||||
},
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/vitejs/vite?sponsor=1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^20.19.0 || >=22.12.0",
|
||||
"@vitejs/devtools": "^0.1.18",
|
||||
"esbuild": "^0.27.0 || ^0.28.0",
|
||||
"jiti": ">=1.21.0",
|
||||
"less": "^4.0.0",
|
||||
"sass": "^1.70.0",
|
||||
"sass-embedded": "^1.70.0",
|
||||
"stylus": ">=0.54.8",
|
||||
"sugarss": "^5.0.0",
|
||||
"terser": "^5.16.0",
|
||||
"tsx": "^4.8.1",
|
||||
"yaml": "^2.4.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
},
|
||||
"@vitejs/devtools": {
|
||||
"optional": true
|
||||
},
|
||||
"esbuild": {
|
||||
"optional": true
|
||||
},
|
||||
"jiti": {
|
||||
"optional": true
|
||||
},
|
||||
"less": {
|
||||
"optional": true
|
||||
},
|
||||
"sass": {
|
||||
"optional": true
|
||||
},
|
||||
"sass-embedded": {
|
||||
"optional": true
|
||||
},
|
||||
"stylus": {
|
||||
"optional": true
|
||||
},
|
||||
"sugarss": {
|
||||
"optional": true
|
||||
},
|
||||
"terser": {
|
||||
"optional": true
|
||||
},
|
||||
"tsx": {
|
||||
"optional": true
|
||||
},
|
||||
"yaml": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"packages/web": {
|
||||
"name": "@arboretum/web",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@arboretum/shared": "*",
|
||||
"@lucide/vue": "^1.21.0",
|
||||
"@xterm/addon-fit": "^0.11.0",
|
||||
"@xterm/addon-webgl": "^0.19.0",
|
||||
"@xterm/xterm": "^6.0.0",
|
||||
|
||||
@@ -10,15 +10,12 @@
|
||||
"node": ">=22.16"
|
||||
},
|
||||
"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",
|
||||
"pack": "npm run build && npm pack -w @johanleroy/git-arboretum",
|
||||
"pack": "npm run build && npm pack -w git-arboretum",
|
||||
"test": "vitest run",
|
||||
"dev:server": "npm run dev -w @johanleroy/git-arboretum",
|
||||
"dev:web": "npm run dev -w @arboretum/web",
|
||||
"build:site": "npm run build -w @arboretum/site",
|
||||
"dev:site": "npm run dev -w @arboretum/site",
|
||||
"preview:site": "npm run preview -w @arboretum/site"
|
||||
"dev:server": "npm run dev -w git-arboretum",
|
||||
"dev:web": "npm run dev -w @arboretum/web"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.10.0",
|
||||
|
||||
@@ -1,59 +1,30 @@
|
||||
{
|
||||
"name": "@johanleroy/git-arboretum",
|
||||
"version": "1.6.1",
|
||||
"name": "git-arboretum",
|
||||
"version": "0.1.0",
|
||||
"description": "Self-hosted web dashboard for git worktrees and the Claude Code sessions running on them",
|
||||
"license": "MIT",
|
||||
"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"
|
||||
},
|
||||
"funding": {
|
||||
"type": "buymeacoffee",
|
||||
"url": "https://buymeacoffee.com/johanleroy"
|
||||
},
|
||||
"keywords": [
|
||||
"git",
|
||||
"worktree",
|
||||
"claude",
|
||||
"claude-code",
|
||||
"dashboard",
|
||||
"self-hosted",
|
||||
"pty",
|
||||
"terminal",
|
||||
"cli",
|
||||
"daemon",
|
||||
"pwa"
|
||||
],
|
||||
"bin": {
|
||||
"arboretum": "./dist/index.js"
|
||||
},
|
||||
"main": "./dist/app.js",
|
||||
"files": [
|
||||
"dist/**/*.js",
|
||||
"dist",
|
||||
"public"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=22.16"
|
||||
},
|
||||
"publishConfig": {
|
||||
"registry": "https://git.lidge.fr/api/packages/johanleroy/npm/"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc -b",
|
||||
"dev": "tsc -b --watch & node --watch dist/index.js",
|
||||
"prepack": "node scripts/copy-web.mjs && node scripts/inline-shared.mjs && node scripts/copy-meta.mjs",
|
||||
"prepack": "node scripts/copy-web.mjs",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@arboretum/shared": "0.1.0",
|
||||
"@fastify/cookie": "^11.0.0",
|
||||
"@fastify/static": "^9.0.0",
|
||||
"@fastify/static": "^8.0.0",
|
||||
"@fastify/websocket": "^11.0.0",
|
||||
"@homebridge/node-pty-prebuilt-multiarch": "^0.13.0",
|
||||
"@xterm/headless": "^6.0.0",
|
||||
@@ -61,7 +32,6 @@
|
||||
"web-push": "^3.6.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arboretum/shared": "0.1.0",
|
||||
"@types/web-push": "^3.6.4",
|
||||
"@types/ws": "^8.5.0"
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ const check = (name, ok, detail = '') => {
|
||||
};
|
||||
|
||||
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' },
|
||||
stdio: ['ignore', 'pipe', 'pipe'],
|
||||
});
|
||||
|
||||
@@ -62,7 +62,7 @@ writeFileSync(
|
||||
|
||||
const srv = spawn(
|
||||
'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'] },
|
||||
);
|
||||
let srvOut = '';
|
||||
@@ -144,37 +144,6 @@ try {
|
||||
const out = c.state.outputs.get(att?.channel) ?? '';
|
||||
check('resume lance `--resume sid-dead` dans le bon cwd', out.includes('args=[--resume sid-dead]') && out.includes(`cwd=${workDir}`), out.replace(/\s+/g, ' ').slice(0, 120));
|
||||
|
||||
// --- Régression « Reprendre » : reprise d'une session MANAGÉE morte par son UUID Arboretum ---
|
||||
// (le bouton web envoie l'UUID managé, pas le claudeSessionId ; le serveur doit le résoudre en DB).
|
||||
const createManaged = await fetch(`${ORIGIN}/api/v1/sessions`, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', Origin: ORIGIN, Cookie: cookie },
|
||||
body: JSON.stringify({ cwd: workDir, command: 'claude' }),
|
||||
});
|
||||
const managed = (await createManaged.json()).session;
|
||||
check('création session managée claude → 201 (pid)', createManaged.status === 201 && managed?.pid > 0);
|
||||
|
||||
// Simule la capture du claudeSessionId : entrée registre pour le pid du PTY managé (pollée toutes les 400ms).
|
||||
writeFileSync(
|
||||
join(sessions, `${managed.pid}.json`),
|
||||
JSON.stringify({ pid: managed.pid, sessionId: 'sid-managed', cwd: workDir, status: 'idle' }),
|
||||
);
|
||||
const captured = await c.waitMsg(
|
||||
(m) => m.type === 'session_update' && m.session?.id === managed.id && m.session?.claudeSessionId === 'sid-managed',
|
||||
);
|
||||
check('claudeSessionId capturé depuis le registre (session managée)', !!captured);
|
||||
|
||||
// Fermeture (kill) puis reprise par UUID managé → 201 dans le cwd d'origine (avant le fix : 404).
|
||||
const killManaged = await fetch(`${ORIGIN}/api/v1/sessions/${managed.id}`, { method: 'DELETE', headers: { Origin: ORIGIN, Cookie: cookie } });
|
||||
check('kill session managée → 200', killManaged.status === 200);
|
||||
await sleep(400); // laisse handleExit persister ended_at
|
||||
const resumeManaged = await postJson(`/api/v1/sessions/${managed.id}/resume`, cookie);
|
||||
const resumedManaged = (await resumeManaged.json()).session;
|
||||
check(
|
||||
'resume d’une session MANAGÉE morte par UUID → 201',
|
||||
resumeManaged.status === 201 && resumedManaged?.command === 'claude' && resumedManaged?.source === 'managed' && resumedManaged?.cwd === workDir,
|
||||
);
|
||||
|
||||
// Broadcast : une nouvelle session découverte est poussée via session_update au rafraîchissement périodique.
|
||||
writeJsonl(workDir, 'sid-new');
|
||||
const pushed = await c.waitMsg((m) => m.type === 'session_update' && m.session?.id === 'sid-new', 13000);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Vrai daemon + vrai repo git tmp. Couvre : enregistrement repo, création worktree avec hook
|
||||
// post-create, broadcast WS worktree_update, corrélation worktree↔session (bash), suppression.
|
||||
import { spawn, execFileSync } from 'node:child_process';
|
||||
import { mkdtempSync, rmSync, existsSync, writeFileSync } from 'node:fs';
|
||||
import { mkdtempSync, rmSync, existsSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join, dirname, basename } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
@@ -36,7 +36,7 @@ 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'],
|
||||
[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'] },
|
||||
);
|
||||
let srvOut = '';
|
||||
@@ -119,24 +119,6 @@ try {
|
||||
const feat = wlist1.worktrees.find((w) => w.branch === 'feat');
|
||||
check('corrélation worktree ↔ session (cwd)', feat?.sessions?.some((s) => s.command === 'bash' && s.live));
|
||||
|
||||
// Session sur le checkout principal (« bosser sur la branche principale ») avec création de branche.
|
||||
const mainSess = await j(`/api/v1/repos/${repoSummary.id}/session`, 'POST', cookie, { command: 'bash', branch: 'mainfeat', newBranch: true });
|
||||
const mainBody = await mainSess.json();
|
||||
check('POST repo session → 201 (bash)', mainSess.status === 201 && mainBody.session?.command === 'bash');
|
||||
check('session de branche principale : cwd = checkout principal', mainBody.session?.cwd === repoSummary.path);
|
||||
const mainPush = await c.waitMsg((m) => m.type === 'worktree_update' && m.worktree?.isMain && m.worktree?.branch === 'mainfeat');
|
||||
check('broadcast worktree_update (branche principale basculée)', !!mainPush);
|
||||
await sleep(300);
|
||||
const wlistM = await (await j('/api/v1/worktrees', 'GET', cookie)).json();
|
||||
const mainWt = wlistM.worktrees.find((w) => w.isMain);
|
||||
check('session corrélée au checkout principal', mainWt?.branch === 'mainfeat' && mainWt.sessions.some((s) => s.id === mainBody.session.id));
|
||||
|
||||
// Refus 409 quand le checkout principal est sale.
|
||||
writeFileSync(join(repo, 'scratch.txt'), 'wip\n');
|
||||
const dirtyRefused = await j(`/api/v1/repos/${repoSummary.id}/session`, 'POST', cookie, { command: 'bash', branch: 'other', newBranch: true });
|
||||
check('repo session sur checkout sale → 409', dirtyRefused.status === 409);
|
||||
rmSync(join(repo, 'scratch.txt'), { force: true });
|
||||
|
||||
// Suppression forcée (une session vit dans le worktree).
|
||||
const refused = await j(`/api/v1/repos/${repoSummary.id}/worktrees?path=${encodeURIComponent(wtPath)}&force=false`, 'DELETE', cookie);
|
||||
check('delete sans force (session live) → 409', refused.status === 409);
|
||||
|
||||
@@ -27,7 +27,7 @@ const tmp = mkdtempSync(join(tmpdir(), 'arb-accept-p4-'));
|
||||
|
||||
const srv = spawn(
|
||||
'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'] },
|
||||
);
|
||||
let srvOut = '';
|
||||
|
||||
@@ -1,188 +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-'));
|
||||
function initRepo(path) {
|
||||
execFileSync('mkdir', ['-p', path]);
|
||||
const git = (...args) => execFileSync('git', args, { cwd: path, 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: path });
|
||||
git('add', '-A');
|
||||
git('commit', '-m', 'init');
|
||||
}
|
||||
const repo = join(tmp, 'demo-repo');
|
||||
const repo2 = join(tmp, 'demo-repo-2');
|
||||
initRepo(repo);
|
||||
initRepo(repo2);
|
||||
|
||||
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);
|
||||
|
||||
// ---- P6 : session de groupe multi-repo (UNE session couvrant tous les repos via --add-dir) ----
|
||||
// Enregistre un 2e repo, l'ajoute au groupe, puis lance UNE session de groupe (bash, sans quota).
|
||||
const addRepo2 = await j('/api/v1/repos', 'POST', cookie, { path: repo2 });
|
||||
const repo2Summary = (await addRepo2.json()).repo;
|
||||
check('POST /repos (2e repo) → 201', addRepo2.status === 201 && repo2Summary?.valid === true);
|
||||
await j(`/api/v1/groups/${group.id}/repos`, 'POST', cookie, { repoId: repo2Summary.id });
|
||||
|
||||
// Mode « checkouts principaux » (pas de branch) : couvre le worktree principal de chaque repo.
|
||||
const gsRes = await j(`/api/v1/groups/${group.id}/session`, 'POST', cookie, { command: 'bash' });
|
||||
const gsBody = await gsRes.json();
|
||||
const gsession = gsBody.session;
|
||||
check('POST /groups/:id/session → 201', gsRes.status === 201 && !!gsession);
|
||||
check('session de groupe : 2 répertoires couverts', Array.isArray(gsBody.dirs) && gsBody.dirs.length === 2);
|
||||
// cwd = parent commun des repos (P6), chaque repo relié en --add-dir → 2 addedDirs.
|
||||
check('session de groupe : cwd = parent commun des repos', gsession?.cwd === tmp);
|
||||
check('session de groupe : addedDirs = les 2 repos', (gsession?.addedDirs?.length ?? 0) === 2);
|
||||
check('session de groupe : groupId posé', gsession?.groupId === group.id);
|
||||
check('session de groupe : cwd parent + 2 repos addedDirs = 3 chemins distincts', new Set([gsession?.cwd, ...(gsession?.addedDirs ?? [])]).size === 3);
|
||||
|
||||
// La session apparaît dans la liste globale avec son groupId.
|
||||
const sessList = await (await j('/api/v1/sessions', 'GET', cookie)).json();
|
||||
const listed = sessList.sessions?.find((s) => s.id === gsession.id);
|
||||
check('GET /sessions : session de groupe présente avec groupId', listed?.groupId === group.id);
|
||||
|
||||
// broadcast WS session_update reçu pour la session de groupe.
|
||||
const pushedSession = await c.waitMsg((m) => m.type === 'session_update' && m.session?.id === gsession.id);
|
||||
check('broadcast WS session_update (session de groupe)', !!pushedSession);
|
||||
|
||||
// groupe sans worktree résolu (branche inexistante) → 400.
|
||||
const gsBad = await j(`/api/v1/groups/${group.id}/session`, 'POST', cookie, { command: 'bash', branch: 'no/such/branch' });
|
||||
check('POST /groups/:id/session branche absente → 400', gsBad.status === 400);
|
||||
|
||||
// Arrêt de la session de groupe + nettoyage du 2e repo (CASCADE retire repo2 de la membership).
|
||||
const killSession = await j(`/api/v1/sessions/${gsession.id}`, 'DELETE', cookie);
|
||||
check('DELETE session de groupe → 200', killSession.status === 200);
|
||||
await j(`/api/v1/repos/${repo2Summary.id}`, 'DELETE', cookie);
|
||||
|
||||
// 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,71 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
// Inline @arboretum/shared (paquet workspace NON publié) directement dans le dist du serveur,
|
||||
// pour que le tarball npm soit 100 % autonome. Branché sur le hook "prepack".
|
||||
//
|
||||
// Pourquoi PAS bundleDependencies : embarquer une dépendance qui est aussi un *workspace* via
|
||||
// bundleDependencies est instable selon l'environnement npm (mode -w, exécution en root sur un
|
||||
// runner CI, version d'arborist) — npm voit le nœud comme un lien workspace et n'embarque parfois
|
||||
// AUCUN fichier ("bundled files: 0"), produisant un paquet cassé chez le consommateur. On élimine
|
||||
// donc toute magie de bundling : on copie le JS compilé de shared dans dist/_shared et on réécrit
|
||||
// l'import bare '@arboretum/shared' du serveur vers ce chemin relatif. Zéro node_modules embarqué,
|
||||
// zéro symlink, résultat identique partout.
|
||||
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
||||
import { join, dirname, relative, sep } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
const serverDir = join(dirname(fileURLToPath(import.meta.url)), '..');
|
||||
const serverDist = join(serverDir, 'dist');
|
||||
const sharedDist = join(serverDir, '..', 'shared', 'dist');
|
||||
const inlineDir = join(serverDist, '_shared');
|
||||
|
||||
for (const [label, p] of [['dist serveur', serverDist], ['dist shared', sharedDist]]) {
|
||||
if (!existsSync(p)) {
|
||||
console.error(`inline-shared: ${label} introuvable (${p}) — lance "npm run build" avant le pack.`);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// 1) Copier le JS compilé de shared dans dist/_shared (uniquement *.js : seul le runtime compte ;
|
||||
// les .d.ts/.map ne sont de toute façon pas publiés via le glob `files`). index.js réexporte
|
||||
// ./protocol.js et ./api.js en relatif → la copie complète préserve la résolution interne.
|
||||
rmSync(inlineDir, { recursive: true, force: true });
|
||||
mkdirSync(inlineDir, { recursive: true });
|
||||
let copied = 0;
|
||||
for (const name of readdirSync(sharedDist)) {
|
||||
if (name.endsWith('.js')) {
|
||||
cpSync(join(sharedDist, name), join(inlineDir, name));
|
||||
copied++;
|
||||
}
|
||||
}
|
||||
if (copied === 0) {
|
||||
console.error(`inline-shared: aucun .js dans ${sharedDist} — shared n'est pas compilé.`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// 2) Réécrire l'import bare '@arboretum/shared' de chaque .js du serveur vers le chemin relatif
|
||||
// (POSIX) pointant sur dist/_shared/index.js, calculé par fichier (profondeur variable).
|
||||
const walk = (dir) =>
|
||||
readdirSync(dir, { withFileTypes: true }).flatMap((e) => {
|
||||
const p = join(dir, e.name);
|
||||
if (e.isDirectory()) return p === inlineDir ? [] : walk(p); // ne pas se réécrire soi-même
|
||||
return e.name.endsWith('.js') ? [p] : [];
|
||||
});
|
||||
|
||||
let rewritten = 0;
|
||||
for (const file of walk(serverDist)) {
|
||||
const src = readFileSync(file, 'utf8');
|
||||
if (!src.includes('@arboretum/shared')) continue;
|
||||
let rel = relative(dirname(file), join(inlineDir, 'index.js')).split(sep).join('/');
|
||||
if (!rel.startsWith('.')) rel = `./${rel}`;
|
||||
const out = src.replaceAll(`'@arboretum/shared'`, `'${rel}'`).replaceAll(`"@arboretum/shared"`, `"${rel}"`);
|
||||
if (out !== src) {
|
||||
writeFileSync(file, out);
|
||||
rewritten++;
|
||||
}
|
||||
}
|
||||
if (rewritten === 0) {
|
||||
console.error(`inline-shared: aucun import '@arboretum/shared' réécrit dans ${serverDist} — build manquant ?`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.log(`inline-shared: ${copied} fichier(s) shared -> dist/_shared, import réécrit dans ${rewritten} fichier(s) serveur`);
|
||||
@@ -1,4 +1,4 @@
|
||||
import Fastify, { type FastifyError, type FastifyInstance, type FastifyRequest } from 'fastify';
|
||||
import Fastify, { type FastifyInstance, type FastifyRequest } from 'fastify';
|
||||
import fastifyCookie from '@fastify/cookie';
|
||||
import fastifyWebsocket from '@fastify/websocket';
|
||||
import fastifyStatic from '@fastify/static';
|
||||
@@ -11,49 +11,13 @@ import { AuthService, LoginRateLimiter, type AuthContext } from './auth/service.
|
||||
import { PtyManager } from './core/pty-manager.js';
|
||||
import { DiscoveryService } from './core/discovery-service.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 { loadSecretBox } from './core/secret-box.js';
|
||||
import { registerAuthRoutes } from './routes/auth.js';
|
||||
import { registerSessionRoutes } from './routes/sessions.js';
|
||||
import { registerRepoRoutes } from './routes/repos.js';
|
||||
import { registerGroupRoutes } from './routes/groups.js';
|
||||
import { registerWorktreeRoutes } from './routes/worktrees.js';
|
||||
import { registerPushRoutes } from './routes/push.js';
|
||||
import { registerSettingsRoutes } from './routes/settings.js';
|
||||
import { registerFsRoutes } from './routes/fs.js';
|
||||
import { registerAuditRoutes } from './routes/audit.js';
|
||||
import { registerDataRoutes } from './routes/data.js';
|
||||
import { registerWsGateway } from './ws/gateway.js';
|
||||
import { isHttpsRequest } from './routes/auth.js';
|
||||
|
||||
// En-têtes de sécurité posés sur TOUTES les réponses (defense-in-depth + conformité scanners
|
||||
// entreprise). Le terminal web reste du RCE par conception : ces en-têtes durcissent la SPA et
|
||||
// le transport, ils ne remplacent pas le modèle loopback + auth + Origin.
|
||||
const SECURITY_HEADERS: Record<string, string> = {
|
||||
'X-Content-Type-Options': 'nosniff',
|
||||
'X-Frame-Options': 'DENY',
|
||||
'Referrer-Policy': 'no-referrer',
|
||||
'Cross-Origin-Opener-Policy': 'same-origin',
|
||||
'Permissions-Policy': 'geolocation=(), microphone=(), camera=(), payment=()',
|
||||
// CSP calibrée pour la SPA : Tailwind/xterm injectent du style inline ; le WebSocket impose
|
||||
// ws:/wss: en connect-src ; le service worker push impose worker-src 'self'.
|
||||
'Content-Security-Policy': [
|
||||
"default-src 'self'",
|
||||
"script-src 'self'",
|
||||
"style-src 'self' 'unsafe-inline'",
|
||||
"img-src 'self' data:",
|
||||
"font-src 'self' data:",
|
||||
"connect-src 'self' ws: wss:",
|
||||
"worker-src 'self'",
|
||||
"manifest-src 'self'",
|
||||
"frame-ancestors 'none'",
|
||||
"base-uri 'self'",
|
||||
"object-src 'none'",
|
||||
"form-action 'self'",
|
||||
].join('; '),
|
||||
};
|
||||
|
||||
declare module 'fastify' {
|
||||
interface FastifyRequest {
|
||||
@@ -69,19 +33,15 @@ export interface AppBundle {
|
||||
auth: AuthService;
|
||||
manager: PtyManager;
|
||||
discovery: DiscoveryService;
|
||||
repoDiscovery: RepoDiscoveryService;
|
||||
worktrees: WorktreeManager;
|
||||
groups: GroupManager;
|
||||
push: PushService;
|
||||
}
|
||||
|
||||
export function buildApp(config: Config, db: Db, serverVersion: string): AppBundle {
|
||||
const app = Fastify({ logger: { level: process.env.ARBORETUM_LOG ?? 'info' } });
|
||||
// Chiffrement au repos des secrets (server_secret, clé privée VAPID) dans la base.
|
||||
const box = loadSecretBox(config.dataDir);
|
||||
const auth = new AuthService(db, box);
|
||||
const auth = new AuthService(db);
|
||||
const limiter = new LoginRateLimiter();
|
||||
const push = new PushService(db, config.vapidContact, undefined, box);
|
||||
const push = new PushService(db, config.vapidContact);
|
||||
const manager = new PtyManager(db, config.claudeSessionsDir, push);
|
||||
const discovery = new DiscoveryService({
|
||||
ptyManager: manager,
|
||||
@@ -89,46 +49,6 @@ export function buildApp(config: Config, db: Db, serverVersion: string): AppBund
|
||||
sessionsDir: config.claudeSessionsDir,
|
||||
});
|
||||
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);
|
||||
|
||||
// En-têtes de sécurité sur toute réponse + no-store sur les réponses sensibles (API/WS).
|
||||
// onSend DOIT retourner le payload (sinon Fastify vide la réponse).
|
||||
app.addHook('onSend', async (req, reply, payload) => {
|
||||
reply.removeHeader('Server'); // anti-fingerprinting (no-op si absent)
|
||||
for (const [k, v] of Object.entries(SECURITY_HEADERS)) reply.header(k, v);
|
||||
if (isHttpsRequest(req)) {
|
||||
reply.header('Strict-Transport-Security', 'max-age=31536000; includeSubDomains');
|
||||
}
|
||||
if (req.url.startsWith('/api/') || req.url.startsWith('/ws')) {
|
||||
reply.header('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0');
|
||||
}
|
||||
return payload;
|
||||
});
|
||||
|
||||
// Garde CSRF defense-in-depth : une mutation porteuse d'un corps DOIT être en application/json
|
||||
// (bloque les soumissions de formulaire cross-site en text/plain, que Fastify parserait sinon).
|
||||
app.addHook('preHandler', async (req, reply) => {
|
||||
if (!['POST', 'PATCH', 'PUT', 'DELETE'].includes(req.method)) return;
|
||||
const len = req.headers['content-length'];
|
||||
if (!len || len === '0') return; // pas de corps : rien à valider
|
||||
const ct = (req.headers['content-type'] ?? '').toLowerCase();
|
||||
if (!ct.startsWith('application/json')) {
|
||||
return reply.status(415).send({ error: { code: 'UNSUPPORTED_MEDIA_TYPE', message: 'Content-Type must be application/json' } });
|
||||
}
|
||||
});
|
||||
|
||||
// Handler d'erreur : ne jamais fuiter de stack/chemin au client ; détail complet côté logs.
|
||||
app.setErrorHandler((err: FastifyError, req, reply) => {
|
||||
const status = err.statusCode && err.statusCode >= 400 && err.statusCode < 600 ? err.statusCode : 500;
|
||||
if (status >= 500) {
|
||||
req.log.error({ err }, 'unhandled error');
|
||||
return reply.status(status).send({ error: { code: 'INTERNAL', message: 'Internal Server Error' } });
|
||||
}
|
||||
// erreurs client (4xx) : code générique, message court non sensible.
|
||||
return reply.status(status).send({ error: { code: err.code ?? 'BAD_REQUEST', message: err.message } });
|
||||
});
|
||||
|
||||
void app.register(fastifyCookie);
|
||||
void app.register(fastifyWebsocket, {
|
||||
@@ -167,20 +87,15 @@ export function buildApp(config: Config, db: Db, serverVersion: string): AppBund
|
||||
}
|
||||
});
|
||||
|
||||
registerAuthRoutes(app, auth, limiter, serverVersion, db);
|
||||
registerAuthRoutes(app, auth, limiter, serverVersion);
|
||||
registerSessionRoutes(app, manager, discovery);
|
||||
registerRepoRoutes(app, worktrees, db);
|
||||
registerGroupRoutes(app, groups, db, worktrees, manager);
|
||||
registerRepoRoutes(app, worktrees);
|
||||
registerWorktreeRoutes(app, worktrees);
|
||||
registerPushRoutes(app, push, db);
|
||||
registerSettingsRoutes(app, db, config, serverVersion, push);
|
||||
registerFsRoutes(app);
|
||||
registerAuditRoutes(app, db);
|
||||
registerDataRoutes(app, db, auth);
|
||||
registerPushRoutes(app, push);
|
||||
// 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).
|
||||
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)
|
||||
@@ -195,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 };
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { createHash, createHmac, randomBytes, randomUUID, timingSafeEqual } from 'node:crypto';
|
||||
import { type Db, getSetting, setSetting } from '../db/index.js';
|
||||
import type { SecretBox } from '../core/secret-box.js';
|
||||
import { recordAudit } from '../core/audit-log.js';
|
||||
|
||||
const COOKIE_NAME = 'arb_session';
|
||||
const COOKIE_TTL_MS = 30 * 24 * 3600 * 1000;
|
||||
@@ -14,21 +12,11 @@ export interface AuthContext {
|
||||
export class AuthService {
|
||||
private readonly secret: Buffer;
|
||||
|
||||
constructor(
|
||||
private readonly db: Db,
|
||||
box?: SecretBox,
|
||||
) {
|
||||
// server_secret chiffré au repos quand un SecretBox est fourni (prod). Migration douce :
|
||||
// une valeur en clair pré-existante est re-chiffrée à la lecture.
|
||||
const stored = getSetting(db, 'server_secret');
|
||||
let secretHex: string;
|
||||
if (!stored) {
|
||||
constructor(private readonly db: Db) {
|
||||
let secretHex = getSetting(db, 'server_secret');
|
||||
if (!secretHex) {
|
||||
secretHex = randomBytes(32).toString('hex');
|
||||
setSetting(db, 'server_secret', box ? box.encrypt(secretHex) : secretHex);
|
||||
recordAudit(db, { actor: 'system', action: 'secret.generate', resourceId: 'server_secret' });
|
||||
} else {
|
||||
secretHex = box ? box.decrypt(stored) : stored;
|
||||
if (box && !box.isEncrypted(stored)) setSetting(db, 'server_secret', box.encrypt(secretHex));
|
||||
setSetting(db, 'server_secret', secretHex);
|
||||
}
|
||||
this.secret = Buffer.from(secretHex, 'hex');
|
||||
}
|
||||
@@ -47,60 +35,11 @@ export class AuthService {
|
||||
}
|
||||
|
||||
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')}`;
|
||||
this.db
|
||||
.prepare('INSERT INTO auth_tokens (id, label, token_hash, created_at) VALUES (?, ?, ?, ?)')
|
||||
.run(id, label, sha256(raw), new Date().toISOString());
|
||||
return { id, token: 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;
|
||||
}
|
||||
.run(randomUUID(), label, sha256(raw), new Date().toISOString());
|
||||
return raw;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import { parseArgs } from 'node:util';
|
||||
import { join } from 'node:path';
|
||||
import { homedir } from 'node:os';
|
||||
import { chmodSync, mkdirSync } from 'node:fs';
|
||||
import { mkdirSync } from 'node:fs';
|
||||
|
||||
export interface Config {
|
||||
port: number;
|
||||
@@ -17,8 +17,6 @@ export interface Config {
|
||||
claudeSessionsDir: string;
|
||||
/** sujet VAPID des notifications Web Push (mailto: ou URL). */
|
||||
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 {
|
||||
@@ -35,8 +33,6 @@ export function loadConfig(argv = process.argv.slice(2)): Config {
|
||||
'claude-home': { type: 'string' },
|
||||
// sujet VAPID des notifications push (contact requis par la spec Web Push).
|
||||
'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,
|
||||
});
|
||||
@@ -53,14 +49,6 @@ export function loadConfig(argv = process.argv.slice(2)): Config {
|
||||
|
||||
const dataDir = join(process.env.XDG_DATA_HOME ?? join(homedir(), '.local', 'share'), 'arboretum');
|
||||
mkdirSync(dataDir, { recursive: true });
|
||||
// La DB contient des secrets (server_secret, clé privée VAPID, hashs de tokens) : le dossier de
|
||||
// données ne doit jamais être lisible par d'autres utilisateurs du système. chmod best-effort
|
||||
// (peut échouer sur certains FS Windows/montés ; le démarrage avertit alors sans bloquer).
|
||||
try {
|
||||
chmodSync(dataDir, 0o700);
|
||||
} catch {
|
||||
/* FS sans permissions POSIX : ignoré, cf. avertissement dans db.openDb */
|
||||
}
|
||||
const claudeHome = values['claude-home'] ?? join(homedir(), '.claude');
|
||||
return {
|
||||
port: Number(values.port),
|
||||
@@ -72,6 +60,5 @@ export function loadConfig(argv = process.argv.slice(2)): Config {
|
||||
claudeProjectsDir: join(claudeHome, 'projects'),
|
||||
claudeSessionsDir: join(claudeHome, 'sessions'),
|
||||
vapidContact: values['vapid-contact'] ?? 'mailto:arboretum@localhost',
|
||||
autoDiscover: !(values['no-discover'] ?? false),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,65 +0,0 @@
|
||||
// Journal d'audit : trace persistante des opérations sensibles (création/révocation de tokens,
|
||||
// changements de réglages, génération de secrets, abonnements push, CRUD groupes). Exigence de
|
||||
// conformité entreprise (GDPR/SOX/ISO 27001). Règle ABSOLUE : ne JAMAIS journaliser un secret en
|
||||
// clair — `details` ne contient que des métadonnées non sensibles (ids, labels, compteurs).
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import type { AuditLogEntry } from '@arboretum/shared';
|
||||
import type { Db } from '../db/index.js';
|
||||
|
||||
export type AuditResult = 'ok' | 'denied' | 'error';
|
||||
|
||||
export interface AuditEntry {
|
||||
/** tokenId de l'acteur, ou 'system' (opérations automatiques), ou 'anonymous' (avant auth). */
|
||||
actor: string;
|
||||
/** verbe.objet, ex. 'token.create', 'settings.update', 'login.failure'. */
|
||||
action: string;
|
||||
resourceId?: string | null;
|
||||
details?: Record<string, unknown> | null;
|
||||
result?: AuditResult;
|
||||
}
|
||||
|
||||
/** Enregistre une entrée d'audit. Best-effort : une erreur d'écriture ne casse jamais l'opération métier. */
|
||||
export function recordAudit(db: Db, e: AuditEntry): void {
|
||||
try {
|
||||
db.prepare(
|
||||
'INSERT INTO audit_logs (id, ts, actor, action, resource_id, details, result) VALUES (?, ?, ?, ?, ?, ?, ?)',
|
||||
).run(
|
||||
randomUUID(),
|
||||
new Date().toISOString(),
|
||||
e.actor,
|
||||
e.action,
|
||||
e.resourceId ?? null,
|
||||
e.details ? JSON.stringify(e.details) : null,
|
||||
e.result ?? 'ok',
|
||||
);
|
||||
} catch {
|
||||
/* l'audit ne doit jamais faire échouer l'action auditée */
|
||||
}
|
||||
}
|
||||
|
||||
/** Liste paginée par date décroissante (curseur `before` = ts strictement inférieur). */
|
||||
export function listAudit(db: Db, opts: { limit: number; before?: string | null }): AuditLogEntry[] {
|
||||
const limit = Math.min(Math.max(Math.trunc(opts.limit) || 50, 1), 200);
|
||||
const rows = (
|
||||
opts.before
|
||||
? db
|
||||
.prepare(
|
||||
'SELECT id, ts, actor, action, resource_id AS resourceId, details, result FROM audit_logs WHERE ts < ? ORDER BY ts DESC LIMIT ?',
|
||||
)
|
||||
.all(opts.before, limit)
|
||||
: db
|
||||
.prepare(
|
||||
'SELECT id, ts, actor, action, resource_id AS resourceId, details, result FROM audit_logs ORDER BY ts DESC LIMIT ?',
|
||||
)
|
||||
.all(limit)
|
||||
) as Array<{ id: string; ts: string; actor: string; action: string; resourceId: string | null; details: string | null; result: string }>;
|
||||
return rows.map((r) => ({ ...r, details: r.details ? safeParse(r.details) : null }));
|
||||
}
|
||||
|
||||
function safeParse(s: string): unknown {
|
||||
try {
|
||||
return JSON.parse(s);
|
||||
} catch {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,6 @@ export interface SpawnOptions {
|
||||
command: 'claude' | 'bash';
|
||||
/** reprise d'une session existante (P2) : `--resume <id>`, `--fork-session` si fork. */
|
||||
resume?: { claudeSessionId: string; fork?: boolean };
|
||||
/** répertoires supplémentaires à relier dans une seule session (P6) : `--add-dir <path>` répété. */
|
||||
addDirs?: string[];
|
||||
}
|
||||
|
||||
let cachedClaudeBin: string | null = null;
|
||||
@@ -44,7 +42,5 @@ export function buildSpawnSpec(opts: SpawnOptions): SpawnSpec {
|
||||
args.push('--resume', opts.resume.claudeSessionId);
|
||||
if (opts.resume.fork) args.push('--fork-session');
|
||||
}
|
||||
// Session de groupe : relie plusieurs repos/worktrees dans une seule session (P6).
|
||||
for (const dir of opts.addDirs ?? []) args.push('--add-dir', dir);
|
||||
return { file: resolveClaudeBin(), args, env };
|
||||
}
|
||||
|
||||
@@ -190,16 +190,6 @@ export async function addWorktree(
|
||||
await git(repoPath, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée/bascule une branche dans le checkout (worktree) en `repoPath` — utilisé pour démarrer une
|
||||
* session sur la branche principale sans worktree dédié. `create` → `git switch -c <branch>` (échoue
|
||||
* si la branche existe) ; sinon `git switch <branch>` (branche existante). Pas de `--` : l'argument
|
||||
* est une réf (pas un pathspec) et le nom est déjà filtré en amont par `isValidBranchName` (anti-flag).
|
||||
*/
|
||||
export async function switchBranch(repoPath: string, opts: { branch: string; create: boolean }): Promise<void> {
|
||||
await git(repoPath, opts.create ? ['switch', '-c', opts.branch] : ['switch', opts.branch]);
|
||||
}
|
||||
|
||||
export async function removeWorktree(repoPath: string, worktreePath: string, force: boolean): Promise<void> {
|
||||
await git(repoPath, ['worktree', 'remove', ...(force ? ['--force'] : []), '--', worktreePath]);
|
||||
}
|
||||
|
||||
@@ -1,203 +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;
|
||||
// Les sessions de groupe (P6) ne sont pas en FK : on désorpheline leur group_id manuellement.
|
||||
this.db.prepare('UPDATE sessions SET group_id = NULL WHERE group_id = ?').run(id);
|
||||
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,37 +0,0 @@
|
||||
import { parse, resolve, sep } from 'node:path';
|
||||
|
||||
/**
|
||||
* Plus long ancêtre commun d'un ensemble de chemins absolus (par segments, jamais par préfixe
|
||||
* de chaîne — `/a/bc` n'est PAS un ancêtre de `/a/bcd`). Pour un seul chemin, renvoie ce chemin.
|
||||
*/
|
||||
export function commonAncestorDir(paths: string[]): string {
|
||||
const first = paths[0];
|
||||
if (first === undefined) throw new Error('commonAncestorDir: empty input');
|
||||
const firstSegs = resolve(first).split(sep);
|
||||
let common = firstSegs.length;
|
||||
for (let i = 1; i < paths.length; i++) {
|
||||
const segs = resolve(paths[i]!).split(sep);
|
||||
let k = 0;
|
||||
while (k < common && k < segs.length && segs[k] === firstSegs[k]) k++;
|
||||
common = k;
|
||||
}
|
||||
const joined = firstSegs.slice(0, common).join(sep);
|
||||
// `['', 'a', 'b'].slice(0,1).join('/')` === '' → racine POSIX ; rétablir le séparateur racine.
|
||||
return joined === '' ? parse(resolve(first)).root : joined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Politique de répertoire de travail d'une session de groupe (P6) : le `cwd` est le PARENT COMMUN
|
||||
* des répertoires couverts (racine neutre, chemins relatifs cross-repo naturels), chaque répertoire
|
||||
* étant ensuite relié via `--add-dir` (le dédoublonnage + filtrage du cwd est fait par `PtyManager`).
|
||||
* Garde-fou : si le parent commun est la racine du FS (repos éparpillés sur des racines différentes),
|
||||
* on retombe sur le premier répertoire pour ne pas accorder à Claude la permission sur tout le disque.
|
||||
*/
|
||||
export function resolveGroupCwd(dirs: string[]): { cwd: string; addDirs: string[] } {
|
||||
const first = dirs[0];
|
||||
if (first === undefined) throw new Error('resolveGroupCwd: empty input');
|
||||
const ancestor = commonAncestorDir(dirs);
|
||||
const root = parse(resolve(first)).root;
|
||||
const cwd = ancestor === root ? first : ancestor;
|
||||
return { cwd, addDirs: dirs };
|
||||
}
|
||||
@@ -20,17 +20,6 @@ const NOTIFY_DEBOUNCE_MS = 1500;
|
||||
const CLAUDE_ID_POLL_MS = 400;
|
||||
const CLAUDE_ID_TIMEOUT_MS = 60_000;
|
||||
|
||||
/** Parse la colonne `added_dirs` (JSON array de chemins) de façon défensive ; [] si NULL/invalide. */
|
||||
function parseAddedDirs(raw: string | null): string[] {
|
||||
if (!raw) return [];
|
||||
try {
|
||||
const v = JSON.parse(raw);
|
||||
return Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
/** Lien entre un client WS attaché et une session. La gateway fournit les callbacks d'envoi. */
|
||||
export interface ClientBinding {
|
||||
channel: number;
|
||||
@@ -59,10 +48,6 @@ interface ManagedSession {
|
||||
killTimer: NodeJS.Timeout | null;
|
||||
/** ID interne du CLI claude, résolu via le registre après spawn (null pour bash / pas encore prêt). */
|
||||
claudeSessionId: string | null;
|
||||
/** répertoires supplémentaires reliés dans la session (--add-dir) ; [] pour une session mono-repo (P6). */
|
||||
addedDirs: string[];
|
||||
/** groupe propriétaire d'une session de groupe multi-repo ; null sinon (P6). */
|
||||
groupId: string | null;
|
||||
/** détection d'état fin (busy/waiting/idle + dialogue) ; null pour bash (P3-B). */
|
||||
tracker: SessionActivityTracker | null;
|
||||
/** dernière activité notifiée (détection du front montant vers `waiting` pour le push P4-B). */
|
||||
@@ -87,33 +72,14 @@ export class PtyManager extends EventEmitter<PtyManagerEvents> {
|
||||
super();
|
||||
}
|
||||
|
||||
spawn(opts: {
|
||||
cwd: string;
|
||||
command?: 'claude' | 'bash';
|
||||
resume?: { claudeSessionId: string; fork?: boolean };
|
||||
/** répertoires supplémentaires à relier (session de groupe multi-repo, P6). */
|
||||
addDirs?: string[];
|
||||
/** groupe propriétaire (session de groupe, P6). */
|
||||
groupId?: string;
|
||||
}): SessionSummary {
|
||||
spawn(opts: { cwd: string; command?: 'claude' | 'bash'; resume?: { claudeSessionId: string; fork?: boolean } }): SessionSummary {
|
||||
const cwd = opts.cwd;
|
||||
if (!existsSync(cwd) || !statSync(cwd).isDirectory()) {
|
||||
throw Object.assign(new Error(`Not a directory: ${cwd}`), { statusCode: 400 });
|
||||
}
|
||||
// Dédoublonne et écarte le cwd primaire ; valide chaque répertoire supplémentaire (comme le cwd).
|
||||
const addedDirs = [...new Set(opts.addDirs ?? [])].filter((d) => d !== cwd);
|
||||
for (const dir of addedDirs) {
|
||||
if (!existsSync(dir) || !statSync(dir).isDirectory()) {
|
||||
throw Object.assign(new Error(`Not a directory: ${dir}`), { statusCode: 400 });
|
||||
}
|
||||
}
|
||||
// Un resume/fork est toujours une session claude (le cwd d'origine est garanti par l'appelant — S1).
|
||||
const command = opts.resume ? 'claude' : (opts.command ?? 'claude');
|
||||
const spec = buildSpawnSpec({
|
||||
command,
|
||||
...(opts.resume ? { resume: opts.resume } : {}),
|
||||
...(addedDirs.length ? { addDirs: addedDirs } : {}),
|
||||
});
|
||||
const spec = buildSpawnSpec({ command, ...(opts.resume ? { resume: opts.resume } : {}) });
|
||||
const id = randomUUID();
|
||||
const proc = pty.spawn(spec.file, spec.args, {
|
||||
name: 'xterm-256color',
|
||||
@@ -135,8 +101,6 @@ export class PtyManager extends EventEmitter<PtyManagerEvents> {
|
||||
exited: null,
|
||||
killTimer: null,
|
||||
claudeSessionId: null,
|
||||
addedDirs,
|
||||
groupId: opts.groupId ?? null,
|
||||
tracker: null,
|
||||
prevActivity: null,
|
||||
notifyTimer: null,
|
||||
@@ -152,16 +116,8 @@ export class PtyManager extends EventEmitter<PtyManagerEvents> {
|
||||
}
|
||||
this.live.set(id, session);
|
||||
this.db
|
||||
.prepare('INSERT INTO sessions (id, cwd, command, created_at, resumed_from, added_dirs, group_id) VALUES (?, ?, ?, ?, ?, ?, ?)')
|
||||
.run(
|
||||
id,
|
||||
cwd,
|
||||
command,
|
||||
session.createdAt,
|
||||
opts.resume?.claudeSessionId ?? null,
|
||||
addedDirs.length ? JSON.stringify(addedDirs) : null,
|
||||
session.groupId,
|
||||
);
|
||||
.prepare('INSERT INTO sessions (id, cwd, command, created_at, resumed_from) VALUES (?, ?, ?, ?, ?)')
|
||||
.run(id, cwd, command, session.createdAt, opts.resume?.claudeSessionId ?? null);
|
||||
|
||||
proc.onData((data) => this.handleOutput(session, Buffer.from(data, 'utf8')));
|
||||
proc.onExit(({ exitCode, signal }) => this.handleExit(session, exitCode, signal ?? null));
|
||||
@@ -189,36 +145,6 @@ export class PtyManager extends EventEmitter<PtyManagerEvents> {
|
||||
setTimeout(tick, CLAUDE_ID_POLL_MS).unref();
|
||||
}
|
||||
|
||||
/**
|
||||
* Contexte de session de groupe (P6) à réinjecter au resume : derniers `added_dirs`/`group_id`
|
||||
* persistés pour ce claudeSessionId. Permet à `--resume` de re-relier les mêmes répertoires.
|
||||
*/
|
||||
groupSessionContext(claudeSessionId: string): { addedDirs: string[]; groupId: string | null } | null {
|
||||
const row = this.db
|
||||
.prepare('SELECT added_dirs, group_id FROM sessions WHERE claude_session_id = ? AND added_dirs IS NOT NULL ORDER BY created_at DESC LIMIT 1')
|
||||
.get(claudeSessionId) as { added_dirs: string | null; group_id: string | null } | undefined;
|
||||
if (!row) return null;
|
||||
return { addedDirs: parseAddedDirs(row.added_dirs), groupId: row.group_id };
|
||||
}
|
||||
|
||||
/**
|
||||
* Cible de reprise d'une session managée MORTE (P2/P6), résolue par UUID Arboretum : son cwd
|
||||
* d'origine, son claudeSessionId et son contexte de groupe, lus en DB. null si l'id ne correspond
|
||||
* pas à une session managée morte, reprenable (claude + claudeSessionId connu).
|
||||
* Complète `DiscoveryService.getDiscovered`, qui ne couvre QUE les sessions claude EXTERNES
|
||||
* (une managée connue est justement exclue de la découverte).
|
||||
*/
|
||||
resumeTargetById(id: string): { cwd: string; claudeSessionId: string; addedDirs: string[]; groupId: string | null } | null {
|
||||
if (this.live.has(id)) return null; // vivante : pas de resume direct (fork via le même chemin)
|
||||
const row = this.db
|
||||
.prepare(
|
||||
"SELECT cwd, claude_session_id, added_dirs, group_id FROM sessions WHERE id = ? AND ended_at IS NOT NULL AND claude_session_id IS NOT NULL AND command = 'claude'",
|
||||
)
|
||||
.get(id) as { cwd: string; claude_session_id: string; added_dirs: string | null; group_id: string | null } | undefined;
|
||||
if (!row) return null;
|
||||
return { cwd: row.cwd, claudeSessionId: row.claude_session_id, addedDirs: parseAddedDirs(row.added_dirs), groupId: row.group_id };
|
||||
}
|
||||
|
||||
/** Session managée VIVANTE portant ce claudeSessionId (garde-fou anti-resume d'une session vivante). */
|
||||
findLiveByClaudeSessionId(claudeSessionId: string): SessionSummary | null {
|
||||
for (const s of this.live.values()) {
|
||||
@@ -244,34 +170,29 @@ export class PtyManager extends EventEmitter<PtyManagerEvents> {
|
||||
const liveSummaries = [...this.live.values()].map((s) => this.summarize(s));
|
||||
const liveIds = new Set(this.live.keys());
|
||||
const rows = this.db
|
||||
.prepare('SELECT id, cwd, command, title, created_at, ended_at, exit_code, claude_session_id, added_dirs, group_id FROM sessions ORDER BY created_at DESC LIMIT 100')
|
||||
.all() as Array<{ id: string; cwd: string; command: string; title: string | null; created_at: string; ended_at: string | null; exit_code: number | null; claude_session_id: string | null; added_dirs: string | null; group_id: string | null }>;
|
||||
.prepare('SELECT id, cwd, command, title, created_at, ended_at, exit_code, claude_session_id FROM sessions ORDER BY created_at DESC LIMIT 100')
|
||||
.all() as Array<{ id: string; cwd: string; command: string; title: string | null; created_at: string; ended_at: string | null; exit_code: number | null; claude_session_id: string | null }>;
|
||||
const historical: SessionSummary[] = rows
|
||||
.filter((r) => !liveIds.has(r.id))
|
||||
.map((r) => {
|
||||
const addedDirs = parseAddedDirs(r.added_dirs);
|
||||
return {
|
||||
id: r.id,
|
||||
cwd: r.cwd,
|
||||
command: r.command,
|
||||
title: r.title,
|
||||
status: 'exited' as const,
|
||||
live: false,
|
||||
createdAt: r.created_at,
|
||||
endedAt: r.ended_at,
|
||||
exitCode: r.exit_code,
|
||||
clients: 0,
|
||||
source: 'managed' as const,
|
||||
claudeSessionId: r.claude_session_id,
|
||||
pid: null,
|
||||
// une session claude morte avec un claudeSessionId connu est reprenable (--resume direct).
|
||||
resumable: r.command === 'claude' && r.claude_session_id != null,
|
||||
attachable: false,
|
||||
registryStatus: null,
|
||||
...(addedDirs.length ? { addedDirs } : {}),
|
||||
groupId: r.group_id,
|
||||
};
|
||||
});
|
||||
.map((r) => ({
|
||||
id: r.id,
|
||||
cwd: r.cwd,
|
||||
command: r.command,
|
||||
title: r.title,
|
||||
status: 'exited',
|
||||
live: false,
|
||||
createdAt: r.created_at,
|
||||
endedAt: r.ended_at,
|
||||
exitCode: r.exit_code,
|
||||
clients: 0,
|
||||
source: 'managed',
|
||||
claudeSessionId: r.claude_session_id,
|
||||
pid: null,
|
||||
// une session claude morte avec un claudeSessionId connu est reprenable (--resume direct).
|
||||
resumable: r.command === 'claude' && r.claude_session_id != null,
|
||||
attachable: false,
|
||||
registryStatus: null,
|
||||
}));
|
||||
return [...liveSummaries, ...historical];
|
||||
}
|
||||
|
||||
@@ -506,8 +427,6 @@ export class PtyManager extends EventEmitter<PtyManagerEvents> {
|
||||
activity: act?.activity ?? null,
|
||||
waitingFor: act?.waitingFor ?? null,
|
||||
dialog: act?.dialog ?? null,
|
||||
...(s.addedDirs.length ? { addedDirs: s.addedDirs } : {}),
|
||||
groupId: s.groupId,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { createRequire } from 'node:module';
|
||||
import { type Db, getSetting, setSetting } from '../db/index.js';
|
||||
import type { SecretBox } from './secret-box.js';
|
||||
import { recordAudit } from './audit-log.js';
|
||||
|
||||
// web-push est publié en CommonJS : on le charge via require (verbatimModuleSyntax + NodeNext),
|
||||
// typé par l'import type — même pattern que @xterm/headless dans screen-reader.ts.
|
||||
@@ -49,22 +47,16 @@ export class PushService {
|
||||
private readonly db: Db,
|
||||
private readonly contact: string = 'mailto:arboretum@localhost',
|
||||
sender?: PushSender,
|
||||
box?: SecretBox,
|
||||
) {
|
||||
this.send = sender ?? ((sub, payload, options) => webpush.sendNotification(sub, payload, options as Parameters<typeof webpush.sendNotification>[2]));
|
||||
let pub = getSetting(db, 'vapid_public'); // clé publique : jamais chiffrée (sûre à exposer)
|
||||
const storedPriv = getSetting(db, 'vapid_private');
|
||||
let priv = storedPriv ? (box ? box.decrypt(storedPriv) : storedPriv) : null;
|
||||
let pub = getSetting(db, 'vapid_public');
|
||||
let priv = getSetting(db, 'vapid_private');
|
||||
if (!pub || !priv) {
|
||||
const keys = webpush.generateVAPIDKeys();
|
||||
pub = keys.publicKey;
|
||||
priv = keys.privateKey;
|
||||
setSetting(db, 'vapid_public', pub);
|
||||
setSetting(db, 'vapid_private', box ? box.encrypt(priv) : priv);
|
||||
recordAudit(db, { actor: 'system', action: 'secret.generate', resourceId: 'vapid' });
|
||||
} else if (box && storedPriv && !box.isEncrypted(storedPriv)) {
|
||||
// migration douce : clé privée pré-existante en clair → re-chiffrée.
|
||||
setSetting(db, 'vapid_private', box.encrypt(priv));
|
||||
setSetting(db, 'vapid_private', priv);
|
||||
}
|
||||
this.vapidPublic = pub;
|
||||
this.vapidPrivate = priv;
|
||||
|
||||
@@ -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,97 +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 ; en profondeur on NE descend PAS dedans (sous-modules/worktrees imbriqués
|
||||
* ignorés). EXCEPTION : une racine fournie (depth 0) qui est elle-même un repo est aussi un
|
||||
* conteneur — on l'enregistre ET on continue de descendre pour trouver les repos internes ;
|
||||
* - 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 dossier avec `.git` est un repo. En PROFONDEUR (depth > 0) c'est une feuille : on
|
||||
// l'enregistre sans descendre (on n'ouvre pas les sous-modules/worktrees imbriqués). Mais une
|
||||
// RACINE fournie explicitement (depth 0) est un CONTENEUR de scan : si elle est elle-même un
|
||||
// repo on l'enregistre, puis on CONTINUE de descendre pour découvrir les dépôts qu'elle contient.
|
||||
if (existsSync(join(dir, '.git'))) {
|
||||
found.add(dir);
|
||||
if (depth > 0) 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,66 +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 { 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 : AUCUNE racine → aucun scan (clean install).
|
||||
* L'utilisateur ajoute ses racines via Réglages → Découverte. Lecture tolérante (JSON malformé → []).
|
||||
*/
|
||||
export function readScanRoots(db: Db): string[] {
|
||||
const raw = getSetting(db, SCAN_ROOTS_KEY);
|
||||
if (!raw) return [];
|
||||
return normalizeScanRoots(safeParse(raw)) ?? [];
|
||||
}
|
||||
|
||||
/** 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;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
// Chiffrement au repos des secrets applicatifs (server_secret HMAC, clé privée VAPID) stockés dans
|
||||
// la table `settings`. node:sqlite (DatabaseSync) ne supporte pas sqlcipher → on chiffre au niveau
|
||||
// applicatif les VALEURS sensibles, en AES-256-GCM (authentifié), avant insertion.
|
||||
//
|
||||
// Gestion de clé (par ordre de priorité) :
|
||||
// 1. ARBORETUM_SECRET_KEY (variable d'env) → vraie protection : la clé ne vit pas sur le disque,
|
||||
// donc une fuite de la base seule (backup, WAL) ne révèle pas les secrets ;
|
||||
// 2. sinon, fichier clé `dataDir/secret.key` (0o600), généré au 1er démarrage. Protection partielle :
|
||||
// couvre la fuite de la base seule, PAS celle du dossier de données complet (clé + base ensemble).
|
||||
// Compromis assumé et documenté (docs/ENTERPRISE_DEPLOYMENT.md) : pour une protection forte, fournir
|
||||
// ARBORETUM_SECRET_KEY et sauvegarder cette clé séparément des backups de la base.
|
||||
import { createCipheriv, createDecipheriv, randomBytes, scryptSync } from 'node:crypto';
|
||||
import { chmodSync, existsSync, readFileSync, writeFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const PREFIX = 'v1:'; // versionne le format ; absence de préfixe = valeur en clair (legacy → migration douce)
|
||||
const SCRYPT_SALT = 'arboretum-secret-box-v1'; // sel fixe : l'entropie vient de la passphrase fournie
|
||||
|
||||
export class SecretBox {
|
||||
constructor(private readonly key: Buffer) {}
|
||||
|
||||
/** Chiffre en `v1:<iv>:<tag>:<ciphertext>` (hex). */
|
||||
encrypt(plaintext: string): string {
|
||||
const iv = randomBytes(12);
|
||||
const cipher = createCipheriv('aes-256-gcm', this.key, iv);
|
||||
const ct = Buffer.concat([cipher.update(plaintext, 'utf8'), cipher.final()]);
|
||||
const tag = cipher.getAuthTag();
|
||||
return `${PREFIX}${iv.toString('hex')}:${tag.toString('hex')}:${ct.toString('hex')}`;
|
||||
}
|
||||
|
||||
/** Déchiffre une valeur `v1:` ; une valeur sans préfixe est retournée telle quelle (clair legacy). */
|
||||
decrypt(stored: string): string {
|
||||
if (!this.isEncrypted(stored)) return stored;
|
||||
const [, ivHex, tagHex, ctHex] = stored.split(':');
|
||||
if (!ivHex || !tagHex || !ctHex) throw new Error('secret-box: format chiffré invalide');
|
||||
const decipher = createDecipheriv('aes-256-gcm', this.key, Buffer.from(ivHex, 'hex'));
|
||||
decipher.setAuthTag(Buffer.from(tagHex, 'hex'));
|
||||
return Buffer.concat([decipher.update(Buffer.from(ctHex, 'hex')), decipher.final()]).toString('utf8');
|
||||
}
|
||||
|
||||
isEncrypted(stored: string): boolean {
|
||||
return stored.startsWith(PREFIX);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construit le SecretBox de production : clé dérivée d'ARBORETUM_SECRET_KEY si fournie, sinon
|
||||
* d'un fichier clé `dataDir/secret.key` (0o600) généré au besoin.
|
||||
*/
|
||||
export function loadSecretBox(dataDir: string): SecretBox {
|
||||
const passphrase = process.env.ARBORETUM_SECRET_KEY;
|
||||
if (passphrase && passphrase.length > 0) {
|
||||
return new SecretBox(scryptSync(passphrase, SCRYPT_SALT, 32));
|
||||
}
|
||||
const keyPath = join(dataDir, 'secret.key');
|
||||
let keyHex: string;
|
||||
if (existsSync(keyPath)) {
|
||||
keyHex = readFileSync(keyPath, 'utf8').trim();
|
||||
} else {
|
||||
keyHex = randomBytes(32).toString('hex');
|
||||
writeFileSync(keyPath, keyHex + '\n', { mode: 0o600 });
|
||||
}
|
||||
try {
|
||||
chmodSync(keyPath, 0o600);
|
||||
} catch {
|
||||
/* FS sans permissions POSIX : ignoré */
|
||||
}
|
||||
return new SecretBox(Buffer.from(keyHex, 'hex'));
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import { randomUUID } from 'node:crypto';
|
||||
import { basename, dirname, join, resolve } from 'node:path';
|
||||
import { existsSync } from 'node:fs';
|
||||
import type {
|
||||
DiscoverReposResponse,
|
||||
HookRunResult,
|
||||
PostCreateHook,
|
||||
RepoSummary,
|
||||
@@ -18,7 +17,6 @@ import type {
|
||||
import type { Db } from '../db/index.js';
|
||||
import type { PtyManager } from './pty-manager.js';
|
||||
import { DiscoveryService, mergeSessions } from './discovery-service.js';
|
||||
import { scanForRepos } from './repo-scanner.js';
|
||||
import { preTrustProject } from './claude-trust.js';
|
||||
import {
|
||||
addWorktree,
|
||||
@@ -30,7 +28,6 @@ import {
|
||||
listWorktrees,
|
||||
pruneWorktrees,
|
||||
removeWorktree,
|
||||
switchBranch,
|
||||
worktreeStatus,
|
||||
type ParsedWorktree,
|
||||
} from './git.js';
|
||||
@@ -38,10 +35,6 @@ import {
|
||||
const FACTS_TTL_MS = 2500;
|
||||
const HOOK_TIMEOUT_MS = 5 * 60_000;
|
||||
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 {
|
||||
id: string;
|
||||
@@ -51,7 +44,6 @@ interface RepoRow {
|
||||
post_create_hooks: string;
|
||||
pre_trust: number;
|
||||
created_at: string;
|
||||
hidden: number;
|
||||
}
|
||||
|
||||
export interface WorktreeManagerEvents {
|
||||
@@ -104,8 +96,6 @@ function runHook(cwd: string, hook: PostCreateHook): Promise<HookRunResult> {
|
||||
export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
||||
private readonly factsCache = new Map<string, { facts: Array<{ w: ParsedWorktree; status: WorktreeGitStatus }>; at: number }>();
|
||||
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(
|
||||
private readonly db: Db,
|
||||
@@ -131,7 +121,6 @@ export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
||||
preTrust: row.pre_trust === 1,
|
||||
createdAt: row.created_at,
|
||||
valid: await isRepo(row.path),
|
||||
hidden: row.hidden === 1,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -154,35 +143,24 @@ export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
||||
post_create_hooks: JSON.stringify(opts.postCreateHooks ?? []),
|
||||
pre_trust: opts.preTrust ? 1 : 0,
|
||||
created_at: new Date().toISOString(),
|
||||
hidden: 0,
|
||||
};
|
||||
try {
|
||||
this.db
|
||||
.prepare('INSERT INTO repos (id, path, label, default_branch, post_create_hooks, pre_trust, created_at, hidden) VALUES (?, ?, ?, ?, ?, ?, ?, ?)')
|
||||
.run(row.id, row.path, row.label, row.default_branch, row.post_create_hooks, row.pre_trust, row.created_at, row.hidden);
|
||||
} 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;
|
||||
}
|
||||
this.db
|
||||
.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);
|
||||
const summary = await this.rowToSummary(row);
|
||||
this.emit('repo_update', 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);
|
||||
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.postCreateHooks !== undefined) row.post_create_hooks = JSON.stringify(patch.postCreateHooks);
|
||||
if (patch.preTrust !== undefined) row.pre_trust = patch.preTrust ? 1 : 0;
|
||||
if (patch.hidden !== undefined) row.hidden = patch.hidden ? 1 : 0;
|
||||
this.db
|
||||
.prepare('UPDATE repos SET label = ?, post_create_hooks = ?, pre_trust = ?, hidden = ? WHERE id = ?')
|
||||
.run(row.label, row.post_create_hooks, row.pre_trust, row.hidden, id);
|
||||
.prepare('UPDATE repos SET label = ?, post_create_hooks = ?, pre_trust = ? WHERE id = ?')
|
||||
.run(row.label, row.post_create_hooks, row.pre_trust, id);
|
||||
const summary = await this.rowToSummary(row);
|
||||
this.emit('repo_update', summary);
|
||||
return summary;
|
||||
@@ -196,53 +174,6 @@ export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
||||
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 ----
|
||||
|
||||
/** Sessions (managées + découvertes) dont le cwd correspond à ce chemin de worktree. */
|
||||
@@ -283,13 +214,8 @@ export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
||||
}
|
||||
|
||||
async listAllWorktrees(): Promise<WorktreeSummary[]> {
|
||||
// Les repos masqués sont exclus du dashboard : inutile de calculer leurs worktrees (sous-process
|
||||
// git par repo). Le front charge paresseusement ceux d'un repo masqué via listRepoWorktrees
|
||||
// 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(() => [])));
|
||||
const rows = this.db.prepare('SELECT id FROM repos ORDER BY created_at ASC').all() as Array<{ id: string }>;
|
||||
const lists = await Promise.all(rows.map((r) => this.listRepoWorktrees(r.id)));
|
||||
return lists.flat();
|
||||
}
|
||||
|
||||
@@ -356,41 +282,6 @@ export class WorktreeManager extends EventEmitter<WorktreeManagerEvents> {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Lance UNE session dans le checkout principal du repo (`repo.path`) — pour « bosser sur la branche
|
||||
* principale » sans créer de worktree. Si `branch` est fourni, crée/bascule d'abord cette branche
|
||||
* dans ce checkout (`git switch[-c]`), refusé si l'arbre est sale (on n'écrase pas un HEAD modifié).
|
||||
* Volontairement SANS hooks ni pré-trust (contraste avec createWorktree) : le checkout principal
|
||||
* est le dépôt réel de l'utilisateur, déjà configuré/approuvé. Sérialisé par repo (withLock).
|
||||
*/
|
||||
async startMainSession(
|
||||
repoId: string,
|
||||
req: { command?: 'claude' | 'bash'; branch?: string; newBranch?: boolean },
|
||||
): Promise<{ session: SessionSummary; worktree: WorktreeSummary | null }> {
|
||||
const row = this.getRepoRow(repoId);
|
||||
if (!row) throw httpError(404, 'NOT_FOUND', 'No repo with this id');
|
||||
const branch = req.branch?.trim() || undefined;
|
||||
if (branch !== undefined && !isValidBranchName(branch)) throw httpError(400, 'BAD_BRANCH', `Invalid branch name: ${branch}`);
|
||||
|
||||
return this.withLock(repoId, async () => {
|
||||
if (branch !== undefined) {
|
||||
// garde-fou : ne pas basculer le HEAD du checkout principal s'il a des changements non sauvegardés.
|
||||
if ((await worktreeStatus(row.path)).dirtyCount > 0) {
|
||||
throw httpError(409, 'DIRTY_TREE', 'Main checkout has uncommitted changes — commit or stash before switching branch');
|
||||
}
|
||||
try {
|
||||
await switchBranch(row.path, { branch, create: req.newBranch ?? true });
|
||||
} catch (err) {
|
||||
throw httpError(400, 'SWITCH_FAILED', (err as Error).message);
|
||||
}
|
||||
this.factsCache.delete(repoId);
|
||||
}
|
||||
const session = this.ptyManager.spawn({ cwd: row.path, command: req.command ?? 'claude' });
|
||||
const worktree = await this.emitWorktree(row, row.path);
|
||||
return { session, worktree };
|
||||
});
|
||||
}
|
||||
|
||||
async adoptWorktree(repoId: string, req: { path: string; runHooks?: boolean; preTrust?: boolean }): Promise<{ worktree: WorktreeSummary; hookResults: HookRunResult[] }> {
|
||||
const row = this.getRepoRow(repoId);
|
||||
if (!row) throw httpError(404, 'NOT_FOUND', 'No repo with this id');
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { DatabaseSync } from 'node:sqlite';
|
||||
import { chmodSync, existsSync } from 'node:fs';
|
||||
|
||||
const MIGRATIONS: Array<{ id: number; sql: string }> = [
|
||||
{
|
||||
@@ -69,66 +68,6 @@ const MIGRATIONS: Array<{ id: number; sql: string }> = [
|
||||
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;`,
|
||||
},
|
||||
{
|
||||
// Journal d'audit (conformité entreprise : GDPR/SOX/ISO 27001). Trace les mutations
|
||||
// sensibles (tokens, réglages, secrets, abonnements push, groupes). Ne contient JAMAIS
|
||||
// de secret en clair — `details` est un JSON de métadonnées non sensibles.
|
||||
id: 7,
|
||||
sql: `
|
||||
CREATE TABLE audit_logs (
|
||||
id TEXT PRIMARY KEY,
|
||||
ts TEXT NOT NULL,
|
||||
actor TEXT NOT NULL,
|
||||
action TEXT NOT NULL,
|
||||
resource_id TEXT,
|
||||
details TEXT,
|
||||
result TEXT NOT NULL
|
||||
);
|
||||
CREATE INDEX idx_audit_ts ON audit_logs(ts);
|
||||
`,
|
||||
},
|
||||
{
|
||||
// P6 — session de groupe multi-repo. Une session peut couvrir plusieurs répertoires (--add-dir)
|
||||
// et appartenir à un groupe. `added_dirs` : JSON array de chemins absolus (NULL si mono-repo).
|
||||
// `group_id` : pas de FK (ALTER ADD COLUMN sqlite n'en pose pas) ; nettoyé à la suppression du groupe.
|
||||
id: 8,
|
||||
sql: `
|
||||
ALTER TABLE sessions ADD COLUMN added_dirs TEXT;
|
||||
ALTER TABLE sessions ADD COLUMN group_id TEXT;
|
||||
CREATE INDEX idx_sessions_group_id ON sessions(group_id);
|
||||
`,
|
||||
},
|
||||
];
|
||||
|
||||
export type Db = DatabaseSync;
|
||||
@@ -137,27 +76,10 @@ export function openDb(path: string): Db {
|
||||
const db = new DatabaseSync(path);
|
||||
db.exec('PRAGMA journal_mode = WAL');
|
||||
db.exec('PRAGMA foreign_keys = ON');
|
||||
hardenDbPermissions(path);
|
||||
migrate(db);
|
||||
return db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restreint la base (et ses fichiers WAL/SHM) à 0o600 — proprio uniquement. La base contient des
|
||||
* secrets (server_secret, clé privée VAPID, hashs de tokens) : elle ne doit jamais être lisible par
|
||||
* d'autres utilisateurs du système. Best-effort : ignoré sur les FS sans permissions POSIX.
|
||||
*/
|
||||
function hardenDbPermissions(path: string): void {
|
||||
if (path === ':memory:') return;
|
||||
for (const p of [path, `${path}-wal`, `${path}-shm`]) {
|
||||
try {
|
||||
if (existsSync(p)) chmodSync(p, 0o600);
|
||||
} catch {
|
||||
/* FS sans permissions POSIX (Windows / montage) : ignoré */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function migrate(db: DatabaseSync): void {
|
||||
db.exec('CREATE TABLE IF NOT EXISTS schema_migrations (id INTEGER PRIMARY KEY, applied_at TEXT NOT NULL)');
|
||||
const applied = new Set(
|
||||
|
||||
@@ -2,30 +2,32 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { loadConfig, type Config } from './config.js';
|
||||
import { loadConfig } from './config.js';
|
||||
import { openDb } from './db/index.js';
|
||||
import { buildApp } from './app.js';
|
||||
import { runInstall, runUninstall, runStatus, printUsage, printTokenBanner } from './cli/install.js';
|
||||
|
||||
const pkg = JSON.parse(
|
||||
readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', 'package.json'), 'utf8'),
|
||||
) as { version: string };
|
||||
|
||||
/** Démarre le daemon : écoute HTTP, scan des sessions, drain propre au SIGTERM/SIGINT. */
|
||||
export async function runDaemon(config: Config): Promise<void> {
|
||||
async function main(): Promise<void> {
|
||||
const config = loadConfig();
|
||||
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();
|
||||
await app.listen({ port: config.port, host: config.bind });
|
||||
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}`;
|
||||
app.log.info(`Arboretum v${pkg.version} — ${url}`);
|
||||
if (bootstrapToken) {
|
||||
// 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) {
|
||||
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;
|
||||
app.log.info(`${signal} received — draining sessions then exiting`);
|
||||
discovery.stop();
|
||||
repoDiscovery.stop();
|
||||
manager.shutdown();
|
||||
setTimeout(() => {
|
||||
void app.close().then(() => process.exit(0));
|
||||
@@ -46,36 +47,6 @@ export async function runDaemon(config: Config): Promise<void> {
|
||||
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) => {
|
||||
console.error(err instanceof Error ? err.message : err);
|
||||
process.exit(1);
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// Consultation du journal d'audit (onglet Réglages / outils de conformité). Lecture seule, sous
|
||||
// l'auth globale. Pagination par curseur `before` (ts décroissant).
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import type { AuditLogsResponse } from '@arboretum/shared';
|
||||
import type { Db } from '../db/index.js';
|
||||
import { listAudit } from '../core/audit-log.js';
|
||||
|
||||
export function registerAuditRoutes(app: FastifyInstance, db: Db): void {
|
||||
app.get('/api/v1/audit-logs', async (req): Promise<AuditLogsResponse> => {
|
||||
const q = req.query as { limit?: string; before?: string };
|
||||
const limit = Math.min(Math.max(Math.trunc(Number(q.limit) || 50), 1), 200);
|
||||
const entries = listAudit(db, { limit, before: q.before ?? null });
|
||||
// s'il reste potentiellement des entrées (page pleine), expose le curseur suivant.
|
||||
const nextBefore = entries.length === limit ? entries[entries.length - 1]!.ts : null;
|
||||
return { entries, nextBefore };
|
||||
});
|
||||
}
|
||||
@@ -1,31 +1,12 @@
|
||||
import type { FastifyInstance, FastifyRequest } from 'fastify';
|
||||
import type {
|
||||
CreateTokenRequest,
|
||||
CreateTokenResponse,
|
||||
LoginRequest,
|
||||
LoginResponse,
|
||||
MeResponse,
|
||||
TokensListResponse,
|
||||
} from '@arboretum/shared';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import type { LoginRequest, LoginResponse, MeResponse } from '@arboretum/shared';
|
||||
import type { AuthService, LoginRateLimiter } from '../auth/service.js';
|
||||
import type { Db } from '../db/index.js';
|
||||
import { recordAudit } from '../core/audit-log.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).
|
||||
export 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(
|
||||
app: FastifyInstance,
|
||||
auth: AuthService,
|
||||
limiter: LoginRateLimiter,
|
||||
serverVersion: string,
|
||||
db: Db,
|
||||
): void {
|
||||
app.post('/api/v1/auth/login', { config: { public: true } }, async (req, reply) => {
|
||||
const wait = limiter.check();
|
||||
@@ -36,16 +17,13 @@ export function registerAuthRoutes(
|
||||
const ctx = typeof body?.token === 'string' ? auth.verifyRawToken(body.token) : null;
|
||||
if (!ctx) {
|
||||
limiter.recordFailure();
|
||||
recordAudit(db, { actor: 'anonymous', action: 'login.failure', result: 'denied' });
|
||||
return reply.status(401).send({ error: { code: 'BAD_TOKEN', message: 'Invalid token' } });
|
||||
}
|
||||
limiter.recordSuccess();
|
||||
recordAudit(db, { actor: ctx.tokenId, action: 'login.success' });
|
||||
void reply.setCookie(auth.cookieName, auth.issueCookie(ctx), {
|
||||
path: '/',
|
||||
httpOnly: true,
|
||||
sameSite: 'strict',
|
||||
secure: isHttpsRequest(req),
|
||||
maxAge: 30 * 24 * 3600,
|
||||
});
|
||||
const res: LoginResponse = { ok: true, label: ctx.label };
|
||||
@@ -53,53 +31,12 @@ export function registerAuthRoutes(
|
||||
});
|
||||
|
||||
app.get('/api/v1/auth/me', async (req, reply) => {
|
||||
const res: MeResponse = {
|
||||
ok: true,
|
||||
tokenId: req.authContext?.tokenId ?? '',
|
||||
tokenLabel: req.authContext?.label ?? 'unknown',
|
||||
serverVersion,
|
||||
};
|
||||
const res: MeResponse = { ok: true, tokenLabel: req.authContext?.label ?? 'unknown', serverVersion };
|
||||
return reply.send(res);
|
||||
});
|
||||
|
||||
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: '/', 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);
|
||||
recordAudit(db, { actor: req.authContext?.tokenId ?? 'unknown', action: 'token.create', resourceId: id, details: { 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);
|
||||
const actor = req.authContext?.tokenId ?? 'unknown';
|
||||
if (result === 'not_found') {
|
||||
return reply.status(404).send({ error: { code: 'NOT_FOUND', message: 'No active token with this id' } });
|
||||
}
|
||||
if (result === 'last') {
|
||||
recordAudit(db, { actor, action: 'token.revoke', resourceId: id, result: 'denied', details: { reason: 'last_active_token' } });
|
||||
return reply.status(409).send({ error: { code: 'LAST_TOKEN', message: 'Cannot revoke the last active token' } });
|
||||
}
|
||||
recordAudit(db, { actor, action: 'token.revoke', resourceId: id });
|
||||
// 200 + corps JSON (pas 204) : le mini-client REST du front parse toujours la réponse.
|
||||
app.post('/api/v1/auth/logout', async (_req, reply) => {
|
||||
void reply.clearCookie(auth.cookieName, { path: '/' });
|
||||
return reply.send({ ok: true });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
// RGPD (droits d'accès & d'effacement) : export et suppression des données rattachées au token
|
||||
// authentifié. Modèle mono-utilisateur → le détenteur du token EST le sujet des données. Sous l'auth
|
||||
// globale. La suppression se fait en deux temps (code de confirmation) pour éviter les clics accidentels.
|
||||
import { createHash } from 'node:crypto';
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import type { DataExportResponse, DeleteMyDataRequest, DeleteMyDataResponse } from '@arboretum/shared';
|
||||
import type { Db } from '../db/index.js';
|
||||
import type { AuthService } from '../auth/service.js';
|
||||
import { readScanIntervalMin, readScanRoots } from '../core/scan-settings.js';
|
||||
import { recordAudit } from '../core/audit-log.js';
|
||||
|
||||
export function registerDataRoutes(app: FastifyInstance, db: Db, auth: AuthService): void {
|
||||
app.get('/api/v1/data/export', async (req): Promise<DataExportResponse> => {
|
||||
const current = req.authContext!.tokenId;
|
||||
const tokens = auth.listTokens().map((t) => ({ ...t, current: t.id === current }));
|
||||
const pushSubscriptions = db
|
||||
.prepare(
|
||||
'SELECT endpoint, user_agent AS userAgent, created_at AS createdAt, last_ok_at AS lastOkAt FROM push_subscriptions WHERE token_id = ?',
|
||||
)
|
||||
.all(current) as DataExportResponse['pushSubscriptions'];
|
||||
const sessions = db
|
||||
.prepare(
|
||||
'SELECT id, cwd, command, title, created_at AS createdAt, ended_at AS endedAt, exit_code AS exitCode FROM sessions ORDER BY created_at',
|
||||
)
|
||||
.all() as DataExportResponse['sessions'];
|
||||
return {
|
||||
exportedAt: new Date().toISOString(),
|
||||
tokens,
|
||||
pushSubscriptions,
|
||||
sessions,
|
||||
settings: { scanRoots: readScanRoots(db), scanIntervalMin: readScanIntervalMin(db) },
|
||||
};
|
||||
});
|
||||
|
||||
app.post('/api/v1/data/delete-my-data', async (req, reply) => {
|
||||
const current = req.authContext!.tokenId;
|
||||
// code déterministe lié au token (sans état serveur) : renvoyé au 1er appel, exigé au 2nd.
|
||||
const code = createHash('sha256').update(`delete:${current}`).digest('hex').slice(0, 12);
|
||||
const body = (req.body as DeleteMyDataRequest | null) ?? {};
|
||||
const subsCount = (db.prepare('SELECT COUNT(*) AS n FROM push_subscriptions WHERE token_id = ?').get(current) as { n: number }).n;
|
||||
|
||||
if (body.confirm !== code) {
|
||||
const res: DeleteMyDataResponse = { status: 'pending', confirm: code, summary: { pushSubscriptions: subsCount, tokenRevoked: false } };
|
||||
return reply.send(res);
|
||||
}
|
||||
|
||||
db.prepare('DELETE FROM push_subscriptions WHERE token_id = ?').run(current);
|
||||
// révoque le token courant (sauf si c'est le dernier actif → garde anti lock-out conservée).
|
||||
const revoked = auth.revokeToken(current) === 'ok';
|
||||
recordAudit(db, { actor: current, action: 'data.delete', details: { pushSubscriptions: subsCount, tokenRevoked: revoked } });
|
||||
const res: DeleteMyDataResponse = { status: 'done', summary: { pushSubscriptions: subsCount, tokenRevoked: revoked } };
|
||||
return reply.send(res);
|
||||
});
|
||||
}
|
||||
@@ -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,161 +0,0 @@
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import type {
|
||||
AddRepoRequest,
|
||||
CreateGroupRequest,
|
||||
CreateGroupSessionRequest,
|
||||
GroupResponse,
|
||||
GroupSessionResponse,
|
||||
GroupsListResponse,
|
||||
UpdateGroupRequest,
|
||||
} from '@arboretum/shared';
|
||||
import type { GroupManager } from '../core/group-manager.js';
|
||||
import type { WorktreeManager } from '../core/worktree-manager.js';
|
||||
import type { PtyManager } from '../core/pty-manager.js';
|
||||
import type { Db } from '../db/index.js';
|
||||
import { recordAudit } from '../core/audit-log.js';
|
||||
import { resolveGroupCwd } from '../core/group-session.js';
|
||||
import { sendManagerError } from './repos.js';
|
||||
|
||||
export function registerGroupRoutes(
|
||||
app: FastifyInstance,
|
||||
gm: GroupManager,
|
||||
db: Db,
|
||||
wt: WorktreeManager,
|
||||
manager: PtyManager,
|
||||
): 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 } : {}),
|
||||
});
|
||||
recordAudit(db, { actor: req.authContext?.tokenId ?? 'unknown', action: 'group.create', resourceId: group.id, details: { label: group.label } });
|
||||
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 } : {}),
|
||||
});
|
||||
recordAudit(db, { actor: req.authContext?.tokenId ?? 'unknown', action: 'group.update', resourceId: id });
|
||||
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' } });
|
||||
}
|
||||
recordAudit(db, { actor: req.authContext?.tokenId ?? 'unknown', action: 'group.delete', resourceId: 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);
|
||||
}
|
||||
});
|
||||
|
||||
// Session de groupe (P6) : UNE session Claude couvrant tous les repos du groupe (--add-dir).
|
||||
// Les répertoires sont résolus côté serveur depuis les propres worktrees du groupe — le client
|
||||
// ne passe jamais de chemin brut. `branch` présent → worktree de cette branche par repo ;
|
||||
// absent → le worktree principal de chaque repo.
|
||||
app.post('/api/v1/groups/:id/session', async (req, reply) => {
|
||||
const { id } = req.params as { id: string };
|
||||
const body = (req.body as Partial<CreateGroupSessionRequest> | null) ?? {};
|
||||
const command = body.command ?? 'claude';
|
||||
if (command !== 'claude' && command !== 'bash') {
|
||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'command must be claude or bash' } });
|
||||
}
|
||||
const branch = typeof body.branch === 'string' && body.branch.trim() !== '' ? body.branch.trim() : null;
|
||||
|
||||
let group;
|
||||
try {
|
||||
group = gm.getGroup(id);
|
||||
} catch (err) {
|
||||
return sendManagerError(reply, err);
|
||||
}
|
||||
|
||||
const dirs: string[] = [];
|
||||
const skipped: Array<{ repoId: string; reason: string }> = [];
|
||||
for (const repoId of group.repoIds) {
|
||||
let worktrees;
|
||||
try {
|
||||
worktrees = await wt.listRepoWorktrees(repoId);
|
||||
} catch (err) {
|
||||
skipped.push({ repoId, reason: err instanceof Error ? err.message : String(err) });
|
||||
continue;
|
||||
}
|
||||
const match = branch ? worktrees.find((w) => w.branch === branch) : worktrees.find((w) => w.isMain);
|
||||
if (!match) {
|
||||
skipped.push({ repoId, reason: branch ? `no worktree on branch ${branch}` : 'no main worktree' });
|
||||
continue;
|
||||
}
|
||||
if (!dirs.includes(match.path)) dirs.push(match.path);
|
||||
}
|
||||
|
||||
if (dirs.length === 0) {
|
||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'no directory to span (group has no resolvable worktree)' } });
|
||||
}
|
||||
// cwd = parent commun des repos couverts, chacun relié en --add-dir (P6). Voir resolveGroupCwd.
|
||||
const { cwd, addDirs } = resolveGroupCwd(dirs);
|
||||
|
||||
try {
|
||||
const session = manager.spawn({ cwd, addDirs, command, groupId: id });
|
||||
recordAudit(db, {
|
||||
actor: req.authContext?.tokenId ?? 'unknown',
|
||||
action: 'group.session.create',
|
||||
resourceId: id,
|
||||
details: { command, dirs: dirs.length, ...(branch ? { branch } : {}) },
|
||||
});
|
||||
return reply.status(201).send({ session, dirs, skipped } satisfies GroupSessionResponse);
|
||||
} catch (err) {
|
||||
const statusCode = (err as { statusCode?: number }).statusCode ?? 500;
|
||||
return reply.status(statusCode).send({ error: { code: 'SPAWN_FAILED', message: (err as Error).message } });
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -3,10 +3,8 @@
|
||||
import type { FastifyInstance } from 'fastify';
|
||||
import type { PushSubscribeRequest, PushUnsubscribeRequest, VapidKeyResponse } from '@arboretum/shared';
|
||||
import type { PushService } from '../core/push-service.js';
|
||||
import type { Db } from '../db/index.js';
|
||||
import { recordAudit } from '../core/audit-log.js';
|
||||
|
||||
export function registerPushRoutes(app: FastifyInstance, push: PushService, db: Db): void {
|
||||
export function registerPushRoutes(app: FastifyInstance, push: PushService): void {
|
||||
app.get('/api/v1/push/vapid-public-key', async (): Promise<VapidKeyResponse> => ({ key: push.publicKey() }));
|
||||
|
||||
app.post('/api/v1/push/subscribe', async (req, reply) => {
|
||||
@@ -17,7 +15,6 @@ export function registerPushRoutes(app: FastifyInstance, push: PushService, db:
|
||||
// garanti non-null : la route est protégée par le preValidation global.
|
||||
const tokenId = req.authContext!.tokenId;
|
||||
push.subscribe(tokenId, { endpoint: body.endpoint, keys: { p256dh: body.keys.p256dh, auth: body.keys.auth } }, req.headers['user-agent'] ?? null);
|
||||
recordAudit(db, { actor: tokenId, action: 'push.subscribe' });
|
||||
return reply.status(201).send({ ok: true });
|
||||
});
|
||||
|
||||
@@ -27,7 +24,6 @@ export function registerPushRoutes(app: FastifyInstance, push: PushService, db:
|
||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'endpoint is required' } });
|
||||
}
|
||||
push.unsubscribe(body.endpoint);
|
||||
recordAudit(db, { actor: req.authContext?.tokenId ?? 'unknown', action: 'push.unsubscribe' });
|
||||
return reply.send({ ok: true });
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
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 { 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. */
|
||||
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' } });
|
||||
}
|
||||
|
||||
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() }));
|
||||
|
||||
// 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) => {
|
||||
const body = req.body as Partial<CreateRepoRequest> | null;
|
||||
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.postCreateHooks !== undefined ? { postCreateHooks: body.postCreateHooks } : {}),
|
||||
...(body.preTrust !== undefined ? { preTrust: body.preTrust } : {}),
|
||||
...(typeof body.hidden === 'boolean' ? { hidden: body.hidden } : {}),
|
||||
});
|
||||
const res: RepoResponse = { repo };
|
||||
return reply.send(res);
|
||||
|
||||
@@ -26,32 +26,20 @@ export function registerSessionRoutes(app: FastifyInstance, manager: PtyManager,
|
||||
}
|
||||
});
|
||||
|
||||
// Reprise d'une session morte : nouveau PTY managé `--resume <claudeSessionId>` DANS SON CWD D'ORIGINE
|
||||
// (spike S1). Le cwd n'est JAMAIS fourni par le client. Deux origines d'id possibles :
|
||||
// - session managée morte (id = UUID Arboretum) → cwd + claudeSessionId + groupe lus en DB ;
|
||||
// - session claude EXTERNE découverte (id = claudeSessionId) → cwd lu sur disque.
|
||||
// Reprise d'une session morte : nouveau PTY managé `--resume <id>` DANS SON CWD D'ORIGINE (spike S1).
|
||||
// Le cwd n'est jamais fourni par le client : il est lu sur disque via la découverte.
|
||||
app.post('/api/v1/sessions/:id/resume', async (req, reply) => {
|
||||
const { id } = req.params as { id: string };
|
||||
const managed = manager.resumeTargetById(id);
|
||||
const discovered = managed ? null : discovery.getDiscovered(id);
|
||||
if (!managed && !discovered) {
|
||||
const discovered = discovery.getDiscovered(id);
|
||||
if (!discovered) {
|
||||
return reply.status(404).send({ error: { code: 'NOT_FOUND', message: 'No resumable session with this id' } });
|
||||
}
|
||||
const cwd = managed ? managed.cwd : discovered!.cwd;
|
||||
const claudeSessionId = managed ? managed.claudeSessionId : id;
|
||||
// Garde-fou anti-corruption : jamais de resume direct d'une session vivante (vérif FRAÎCHE).
|
||||
if (discovery.isClaudeSessionLive(claudeSessionId) || manager.findLiveByClaudeSessionId(claudeSessionId)) {
|
||||
if (discovery.isClaudeSessionLive(id) || manager.findLiveByClaudeSessionId(id)) {
|
||||
return reply.status(409).send({ error: { code: 'SESSION_LIVE', message: 'Session is live — fork it instead' } });
|
||||
}
|
||||
try {
|
||||
// Session de groupe (P6) : re-relie les mêmes répertoires (--add-dir) et son groupe au resume.
|
||||
const ctx = managed ? { addedDirs: managed.addedDirs, groupId: managed.groupId } : manager.groupSessionContext(claudeSessionId);
|
||||
const session = manager.spawn({
|
||||
cwd,
|
||||
resume: { claudeSessionId },
|
||||
...(ctx?.addedDirs.length ? { addDirs: ctx.addedDirs } : {}),
|
||||
...(ctx?.groupId ? { groupId: ctx.groupId } : {}),
|
||||
});
|
||||
const session = manager.spawn({ cwd: discovered.cwd, resume: { claudeSessionId: id } });
|
||||
const res: SessionResponse = { session };
|
||||
return reply.status(201).send(res);
|
||||
} catch (err) {
|
||||
@@ -61,18 +49,14 @@ export function registerSessionRoutes(app: FastifyInstance, manager: PtyManager,
|
||||
});
|
||||
|
||||
// Fork : duplique une session (vivante ou morte) sans la corrompre (`--resume <id> --fork-session`).
|
||||
// Même résolution d'id que /resume (managée morte par UUID, sinon externe découverte par claudeSessionId).
|
||||
app.post('/api/v1/sessions/:id/fork', async (req, reply) => {
|
||||
const { id } = req.params as { id: string };
|
||||
const managed = manager.resumeTargetById(id);
|
||||
const discovered = managed ? null : discovery.getDiscovered(id);
|
||||
if (!managed && !discovered) {
|
||||
const discovered = discovery.getDiscovered(id);
|
||||
if (!discovered) {
|
||||
return reply.status(404).send({ error: { code: 'NOT_FOUND', message: 'No session with this id to fork' } });
|
||||
}
|
||||
const cwd = managed ? managed.cwd : discovered!.cwd;
|
||||
const claudeSessionId = managed ? managed.claudeSessionId : id;
|
||||
try {
|
||||
const session = manager.spawn({ cwd, resume: { claudeSessionId, fork: true } });
|
||||
const session = manager.spawn({ cwd: discovered.cwd, resume: { claudeSessionId: id, fork: true } });
|
||||
const res: SessionResponse = { session };
|
||||
return reply.status(201).send(res);
|
||||
} catch (err) {
|
||||
|
||||
@@ -1,69 +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, setSetting } from '../db/index.js';
|
||||
import type { PushService } from '../core/push-service.js';
|
||||
import { recordAudit } from '../core/audit-log.js';
|
||||
import {
|
||||
SCAN_INTERVAL_KEY,
|
||||
SCAN_ROOTS_KEY,
|
||||
normalizeScanIntervalMin,
|
||||
normalizeScanRoots,
|
||||
readScanIntervalMin,
|
||||
readScanRoots,
|
||||
} from '../core/scan-settings.js';
|
||||
|
||||
// Réglages modifiables via l'API (allow-list stricte). Les secrets ne figurent JAMAIS ici.
|
||||
export function registerSettingsRoutes(
|
||||
app: FastifyInstance,
|
||||
db: Db,
|
||||
config: Config,
|
||||
serverVersion: string,
|
||||
push: PushService,
|
||||
): void {
|
||||
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: {
|
||||
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 ('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));
|
||||
}
|
||||
recordAudit(db, {
|
||||
actor: req.authContext?.tokenId ?? 'unknown',
|
||||
action: 'settings.update',
|
||||
details: { keys: Object.keys(body) },
|
||||
});
|
||||
return reply.send(snapshot());
|
||||
});
|
||||
}
|
||||
@@ -3,8 +3,6 @@ import type {
|
||||
AdoptWorktreeRequest,
|
||||
CreateWorktreeRequest,
|
||||
CreateWorktreeResponse,
|
||||
SessionResponse,
|
||||
StartRepoSessionRequest,
|
||||
WorktreeResponse,
|
||||
WorktreesListResponse,
|
||||
} from '@arboretum/shared';
|
||||
@@ -45,33 +43,6 @@ export function registerWorktreeRoutes(app: FastifyInstance, wt: WorktreeManager
|
||||
}
|
||||
});
|
||||
|
||||
// Session sur le checkout principal (« bosser sur la branche principale » sans worktree),
|
||||
// avec création/bascule de branche optionnelle côté serveur.
|
||||
app.post('/api/v1/repos/:id/session', async (req, reply) => {
|
||||
const { id } = req.params as { id: string };
|
||||
const body = (req.body as Partial<StartRepoSessionRequest> | null) ?? {};
|
||||
if (body.command != null && body.command !== 'claude' && body.command !== 'bash') {
|
||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'command must be claude or bash' } });
|
||||
}
|
||||
if (body.branch != null && typeof body.branch !== 'string') {
|
||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'branch must be a string' } });
|
||||
}
|
||||
if (body.newBranch != null && typeof body.newBranch !== 'boolean') {
|
||||
return reply.status(400).send({ error: { code: 'BAD_REQUEST', message: 'newBranch must be a boolean' } });
|
||||
}
|
||||
try {
|
||||
const out = await wt.startMainSession(id, {
|
||||
...(body.command !== undefined ? { command: body.command } : {}),
|
||||
...(body.branch !== undefined ? { branch: body.branch } : {}),
|
||||
...(body.newBranch !== undefined ? { newBranch: body.newBranch } : {}),
|
||||
});
|
||||
const res: SessionResponse = { session: out.session };
|
||||
return reply.status(201).send(res);
|
||||
} catch (err) {
|
||||
return sendManagerError(reply, err);
|
||||
}
|
||||
});
|
||||
|
||||
app.post('/api/v1/repos/:id/worktrees/adopt', async (req, reply) => {
|
||||
const { id } = req.params as { id: string };
|
||||
const body = req.body as Partial<AdoptWorktreeRequest> | null;
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
PROTOCOL_VERSION,
|
||||
encodeBinaryFrame,
|
||||
parseClientMessage,
|
||||
type GroupSummary,
|
||||
type RepoSummary,
|
||||
type ServerMessage,
|
||||
type SessionSummary,
|
||||
@@ -14,7 +13,6 @@ import {
|
||||
import type { ClientBinding, PtyManager } from '../core/pty-manager.js';
|
||||
import type { DiscoveryService } from '../core/discovery-service.js';
|
||||
import type { WorktreeManager } from '../core/worktree-manager.js';
|
||||
import type { GroupManager } from '../core/group-manager.js';
|
||||
|
||||
const HEARTBEAT_MS = 30_000;
|
||||
|
||||
@@ -28,7 +26,6 @@ export function registerWsGateway(
|
||||
manager: PtyManager,
|
||||
discovery: DiscoveryService,
|
||||
worktrees: WorktreeManager,
|
||||
groups: GroupManager,
|
||||
serverVersion: string,
|
||||
): void {
|
||||
app.get('/ws', { websocket: true }, (socket: WebSocket, req) => {
|
||||
@@ -38,7 +35,6 @@ export function registerWsGateway(
|
||||
let helloDone = false;
|
||||
let subscribedSessions = false;
|
||||
let subscribedWorktrees = false;
|
||||
let subscribedGroups = false;
|
||||
let alive = true;
|
||||
|
||||
const send = (msg: ServerMessage): void => {
|
||||
@@ -70,12 +66,6 @@ export function registerWsGateway(
|
||||
const onWorktreeRemoved = (e: { repoId: string; path: string }): void => {
|
||||
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_exit', onSessionExit);
|
||||
discovery.on('discovery_update', onDiscoveryUpdate);
|
||||
@@ -83,8 +73,6 @@ export function registerWsGateway(
|
||||
worktrees.on('repo_removed', onRepoRemoved);
|
||||
worktrees.on('worktree_update', onWorktreeUpdate);
|
||||
worktrees.on('worktree_removed', onWorktreeRemoved);
|
||||
groups.on('group_update', onGroupUpdate);
|
||||
groups.on('group_removed', onGroupRemoved);
|
||||
|
||||
const heartbeat = setInterval(() => {
|
||||
if (!alive) {
|
||||
@@ -123,7 +111,6 @@ export function registerWsGateway(
|
||||
case 'sub': {
|
||||
subscribedSessions = msg.topics.includes('sessions');
|
||||
subscribedWorktrees = msg.topics.includes('worktrees');
|
||||
subscribedGroups = msg.topics.includes('groups');
|
||||
return;
|
||||
}
|
||||
case 'attach': {
|
||||
@@ -215,8 +202,6 @@ export function registerWsGateway(
|
||||
worktrees.off('repo_removed', onRepoRemoved);
|
||||
worktrees.off('worktree_update', onWorktreeUpdate);
|
||||
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);
|
||||
channels.clear();
|
||||
});
|
||||
|
||||
@@ -7,7 +7,6 @@ import { openDb, type Db } from '../src/db/index.js';
|
||||
import { munge } from '../src/core/jsonl-discovery.js';
|
||||
import { readProcStart } from '../src/core/session-registry.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.
|
||||
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?.httpOnly).toBe(true);
|
||||
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;
|
||||
});
|
||||
|
||||
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 () => {
|
||||
for (const url of ['/api/v1/sessions', '/api/v1/auth/me']) {
|
||||
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 },
|
||||
});
|
||||
expect(me.statusCode).toBe(200);
|
||||
expect(me.json()).toMatchObject({ ok: true, tokenLabel: 'initial', serverVersion: '0.0.0-test' });
|
||||
expect(typeof (me.json() as { tokenId: string }).tokenId).toBe('string');
|
||||
expect(me.json()).toEqual({ ok: true, tokenLabel: 'initial', serverVersion: '0.0.0-test' });
|
||||
});
|
||||
|
||||
it('cookie altéré → 401', async () => {
|
||||
@@ -355,59 +337,3 @@ describe('app e2e — découverte, resume & fork (P2)', () => {
|
||||
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,164 +0,0 @@
|
||||
// Lot 5 — sécurité enterprise : en-têtes de sécurité, journal d'audit, RGPD (export/suppression),
|
||||
// garde Content-Type. Vérifie le câblage de bout en bout via buildApp + token bootstrap.
|
||||
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 { AuditLogsResponse, DataExportResponse, DeleteMyDataResponse } 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-audit-'));
|
||||
const dbPath = join(dir, 'audit.db');
|
||||
db = openDb(dbPath);
|
||||
const config: Config = {
|
||||
port: 9998,
|
||||
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',
|
||||
autoDiscover: false,
|
||||
};
|
||||
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('En-têtes de sécurité', () => {
|
||||
it('pose les en-têtes durs + no-store sur /api, sans header Server', async () => {
|
||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/auth/me', headers: auth() });
|
||||
expect(res.statusCode).toBe(200);
|
||||
expect(res.headers['x-content-type-options']).toBe('nosniff');
|
||||
expect(res.headers['x-frame-options']).toBe('DENY');
|
||||
expect(res.headers['referrer-policy']).toBe('no-referrer');
|
||||
expect(res.headers['content-security-policy']).toContain("default-src 'self'");
|
||||
expect(res.headers['content-security-policy']).toContain("frame-ancestors 'none'");
|
||||
expect(String(res.headers['cache-control'])).toContain('no-store');
|
||||
expect(res.headers['server']).toBeUndefined();
|
||||
});
|
||||
|
||||
it('pose HSTS uniquement derrière HTTPS (x-forwarded-proto)', async () => {
|
||||
const http = await bundle.app.inject({ method: 'GET', url: '/api/v1/auth/me', headers: auth() });
|
||||
expect(http.headers['strict-transport-security']).toBeUndefined();
|
||||
const https = await bundle.app.inject({
|
||||
method: 'GET',
|
||||
url: '/api/v1/auth/me',
|
||||
headers: { ...auth(), 'x-forwarded-proto': 'https' },
|
||||
});
|
||||
expect(String(https.headers['strict-transport-security'])).toContain('max-age=');
|
||||
});
|
||||
|
||||
it('rejette une mutation avec corps non-JSON (415)', async () => {
|
||||
const res = await bundle.app.inject({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth/tokens',
|
||||
headers: { ...auth(), 'content-type': 'text/plain' },
|
||||
payload: 'label=pwned',
|
||||
});
|
||||
expect(res.statusCode).toBe(415);
|
||||
});
|
||||
});
|
||||
|
||||
describe('Journal d’audit', () => {
|
||||
it('journalise la création de token et l’expose via GET /audit-logs', async () => {
|
||||
const create = await bundle.app.inject({
|
||||
method: 'POST',
|
||||
url: '/api/v1/auth/tokens',
|
||||
headers: auth(),
|
||||
payload: { label: 'ci-extra' },
|
||||
});
|
||||
expect(create.statusCode).toBe(201);
|
||||
|
||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/audit-logs', headers: auth() });
|
||||
expect(res.statusCode).toBe(200);
|
||||
const body = res.json() as AuditLogsResponse;
|
||||
const actions = body.entries.map((e) => e.action);
|
||||
expect(actions).toContain('token.create');
|
||||
expect(actions).toContain('secret.generate'); // généré au bootstrap (system)
|
||||
// aucune VALEUR secrète en clair : pas de chaîne hex de 64 caractères (server_secret / clé).
|
||||
// (les ids sont des UUID avec tirets → non concernés ; 'server_secret' est un nom de ressource.)
|
||||
expect(res.body).not.toMatch(/[a-f0-9]{64}/i);
|
||||
});
|
||||
|
||||
it('journalise les échecs de login (actor anonymous)', async () => {
|
||||
await bundle.app.inject({ method: 'POST', url: '/api/v1/auth/login', payload: { token: 'arb_invalid_xxx' } });
|
||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/audit-logs?limit=200', headers: auth() });
|
||||
const body = res.json() as AuditLogsResponse;
|
||||
expect(body.entries.some((e) => e.action === 'login.failure' && e.actor === 'anonymous')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('RGPD', () => {
|
||||
it('exporte les données du token authentifié', async () => {
|
||||
const res = await bundle.app.inject({ method: 'GET', url: '/api/v1/data/export', headers: auth() });
|
||||
expect(res.statusCode).toBe(200);
|
||||
const body = res.json() as DataExportResponse;
|
||||
expect(Array.isArray(body.tokens)).toBe(true);
|
||||
expect(body.tokens.some((t) => t.current)).toBe(true);
|
||||
expect(Array.isArray(body.pushSubscriptions)).toBe(true);
|
||||
expect(Array.isArray(body.sessions)).toBe(true);
|
||||
expect(body.settings).toHaveProperty('scanRoots');
|
||||
});
|
||||
|
||||
it('supprime en deux temps (pending → confirm → done) et révoque le token', async () => {
|
||||
const pending = await bundle.app.inject({ method: 'POST', url: '/api/v1/data/delete-my-data', headers: auth(), payload: {} });
|
||||
const p = pending.json() as DeleteMyDataResponse;
|
||||
expect(p.status).toBe('pending');
|
||||
expect(p.confirm).toBeTruthy();
|
||||
|
||||
// un 2e token existe (créé plus haut) → révoquer le token courant est autorisé.
|
||||
const done = await bundle.app.inject({
|
||||
method: 'POST',
|
||||
url: '/api/v1/data/delete-my-data',
|
||||
headers: auth(),
|
||||
payload: { confirm: p.confirm },
|
||||
});
|
||||
const d = done.json() as DeleteMyDataResponse;
|
||||
expect(d.status).toBe('done');
|
||||
expect(d.summary.tokenRevoked).toBe(true);
|
||||
|
||||
// le token courant est désormais révoqué → 401.
|
||||
const after = await bundle.app.inject({ method: 'GET', url: '/api/v1/auth/me', headers: auth() });
|
||||
expect(after.statusCode).toBe(401);
|
||||
});
|
||||
});
|
||||
@@ -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,29 +0,0 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { buildSpawnSpec } from '../src/core/claude-launcher.js';
|
||||
|
||||
// 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' }));
|
||||
|
||||
describe('buildSpawnSpec — session de groupe multi-repo (P6)', () => {
|
||||
it('émet un --add-dir par répertoire supplémentaire (claude)', () => {
|
||||
const spec = buildSpawnSpec({ command: 'claude', addDirs: ['/a', '/b', '/c'] });
|
||||
expect(spec.file).toBe('/usr/bin/claude');
|
||||
expect(spec.args).toEqual(['--add-dir', '/a', '--add-dir', '/b', '--add-dir', '/c']);
|
||||
});
|
||||
|
||||
it('combine --resume et --add-dir (reprise d’une session de groupe)', () => {
|
||||
const spec = buildSpawnSpec({ command: 'claude', resume: { claudeSessionId: 'sid' }, addDirs: ['/x'] });
|
||||
expect(spec.args).toEqual(['--resume', 'sid', '--add-dir', '/x']);
|
||||
});
|
||||
|
||||
it('aucun --add-dir quand addDirs est vide/absent', () => {
|
||||
expect(buildSpawnSpec({ command: 'claude' }).args).toEqual([]);
|
||||
expect(buildSpawnSpec({ command: 'claude', addDirs: [] }).args).toEqual([]);
|
||||
});
|
||||
|
||||
it('ignore addDirs pour bash (pas de --add-dir)', () => {
|
||||
const spec = buildSpawnSpec({ command: 'bash', addDirs: ['/a', '/b'] });
|
||||
expect(spec.file).toBe('bash');
|
||||
expect(spec.args).toEqual(['--norc']);
|
||||
});
|
||||
});
|
||||
@@ -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 { 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é. */
|
||||
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', () => {
|
||||
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.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)', () => {
|
||||
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);
|
||||
const withOpts = perms.find((s) => s.dialog.options.length >= 2);
|
||||
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 () => {
|
||||
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.some((s) => s.dialog.options.some((o) => /Rouge/.test(o.label)))).toBe(true);
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
@@ -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).
|
||||
describe('campagne de fiabilité P4-C — tous les types de dialogue', () => {
|
||||
const realCaptures: Array<{ fixture: string; kind: DialogKind }> = [
|
||||
{ fixture: 'trust.raw', kind: 'trust' },
|
||||
{ fixture: 'perm-write2.raw', kind: 'permission' },
|
||||
{ fixture: 'perm-bash2.raw', kind: 'permission' },
|
||||
{ fixture: 'ask2.raw', kind: 'question' },
|
||||
{ fixture: 'trust.raw.log', kind: 'trust' },
|
||||
{ fixture: 'perm-write2.raw.log', kind: 'permission' },
|
||||
{ fixture: 'perm-bash2.raw.log', kind: 'permission' },
|
||||
{ fixture: 'ask2.raw.log', kind: 'question' },
|
||||
];
|
||||
for (const c of realCaptures) {
|
||||
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 () => {
|
||||
// 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);
|
||||
});
|
||||
|
||||
|
||||
@@ -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 Devon![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;153mExample[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[32GDevon![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;153mExample[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(America/Lima)[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(America/Lima)[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(America/Lima)[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(America/Lima)[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 Devon![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;153mExample[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(America/Lima)[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 Devon![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;153mExample[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 Devon![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;153mExample[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[32GDevon![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;153mExample[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(America/Lima)[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(America/Lima)[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(America/Lima)[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(America/Lima)[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[32GDevon![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;153mExample[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 Devon![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;153mExample[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' } });
|
||||
});
|
||||
});
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
addWorktree,
|
||||
removeWorktree,
|
||||
pruneWorktrees,
|
||||
switchBranch,
|
||||
isDirtyWorktreeError,
|
||||
} from '../src/core/git.js';
|
||||
|
||||
@@ -119,20 +118,6 @@ describe('opérations git (repo tmp réel)', () => {
|
||||
expect((await listWorktrees(repo)).some((w) => resolve(w.path) === resolve(wtPath))).toBe(false);
|
||||
});
|
||||
|
||||
it('switchBranch : create=true crée une branche, create=false bascule sur une existante', async () => {
|
||||
const repo = makeTmpRepo();
|
||||
const cur = (): string => execFileSync('git', ['branch', '--show-current'], { cwd: repo }).toString().trim();
|
||||
|
||||
await switchBranch(repo, { branch: 'feature/new', create: true });
|
||||
expect(cur()).toBe('feature/new');
|
||||
|
||||
await switchBranch(repo, { branch: 'main', create: false });
|
||||
expect(cur()).toBe('main');
|
||||
|
||||
// créer une branche déjà existante échoue (git refuse).
|
||||
await expect(switchBranch(repo, { branch: 'feature/new', create: true })).rejects.toBeDefined();
|
||||
});
|
||||
|
||||
it('prune retire un worktree dont le dossier a disparu', async () => {
|
||||
const repo = makeTmpRepo();
|
||||
const wtPath = join(dirname(repo), `${basename(repo)}-wt-gone`);
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { commonAncestorDir, resolveGroupCwd } from '../src/core/group-session.js';
|
||||
|
||||
describe('commonAncestorDir', () => {
|
||||
it('renvoie le chemin lui-même pour un seul répertoire', () => {
|
||||
expect(commonAncestorDir(['/home/johan/WebstormProjects/arboretum'])).toBe('/home/johan/WebstormProjects/arboretum');
|
||||
});
|
||||
|
||||
it('renvoie le parent commun de deux siblings', () => {
|
||||
expect(commonAncestorDir(['/p/a', '/p/b'])).toBe('/p');
|
||||
});
|
||||
|
||||
it('gère un répertoire ancêtre d’un autre', () => {
|
||||
expect(commonAncestorDir(['/p/a', '/p/a/b'])).toBe('/p/a');
|
||||
});
|
||||
|
||||
it('compare par segments, pas par préfixe de chaîne', () => {
|
||||
// /a/bc n'est PAS un ancêtre de /a/bcd : ancêtre commun = /a
|
||||
expect(commonAncestorDir(['/a/bc', '/a/bcd'])).toBe('/a');
|
||||
});
|
||||
|
||||
it('renvoie la racine quand aucun segment n’est commun', () => {
|
||||
expect(commonAncestorDir(['/x/a', '/y/b'])).toBe('/');
|
||||
});
|
||||
});
|
||||
|
||||
describe('resolveGroupCwd', () => {
|
||||
it('mono-repo : cwd = le repo, addDirs sera filtré à vide par PtyManager', () => {
|
||||
const { cwd, addDirs } = resolveGroupCwd(['/p/a']);
|
||||
expect(cwd).toBe('/p/a');
|
||||
expect(addDirs).toEqual(['/p/a']);
|
||||
});
|
||||
|
||||
it('multi-repos sous un parent commun : cwd = parent, addDirs = tous les repos', () => {
|
||||
const dirs = ['/home/johan/WebstormProjects/beehelp_lambdas', '/home/johan/WebstormProjects/beehelp_api'];
|
||||
const { cwd, addDirs } = resolveGroupCwd(dirs);
|
||||
expect(cwd).toBe('/home/johan/WebstormProjects');
|
||||
expect(addDirs).toEqual(dirs);
|
||||
});
|
||||
|
||||
it('garde-fou : repos sur des racines différentes → retombe sur le premier répertoire', () => {
|
||||
const { cwd } = resolveGroupCwd(['/x/a', '/y/b']);
|
||||
expect(cwd).toBe('/x/a');
|
||||
});
|
||||
});
|
||||
@@ -1,111 +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']);
|
||||
});
|
||||
|
||||
it('deleteGroup : désorpheline le group_id des sessions de groupe (P6)', () => {
|
||||
const g = gm.createGroup({ label: 'A' });
|
||||
// session de groupe liée à g (insérée directement, comme le ferait PtyManager.spawn).
|
||||
db.prepare(
|
||||
'INSERT INTO sessions (id, cwd, command, created_at, group_id) VALUES (?, ?, ?, ?, ?)',
|
||||
).run('sess-1', '/tmp/a', 'claude', new Date().toISOString(), g.id);
|
||||
expect(gm.deleteGroup(g.id)).toBe(true);
|
||||
const row = db.prepare('SELECT group_id FROM sessions WHERE id = ?').get('sess-1') as { group_id: string | null };
|
||||
expect(row.group_id).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -13,7 +13,7 @@ function writeJsonl(projectsDir: string, cwd: string, sid: string, lines: object
|
||||
describe('munge', () => {
|
||||
it('reproduit le nom de dossier ~/.claude/projects', () => {
|
||||
expect(munge('/home/x/My Project!')).toBe('-home-x-My-Project-');
|
||||
expect(munge('/home/user/projects/demo')).toBe('-home-user-projects-demo');
|
||||
expect(munge('/home/johan/WebstormProjects/arboretum')).toBe('-home-johan-WebstormProjects-arboretum');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -187,34 +187,6 @@ describe('PtyManager (pty mocké)', () => {
|
||||
expect(listed).toMatchObject({ live: false, resumable: true, claudeSessionId: 'sid-known' });
|
||||
});
|
||||
|
||||
it('resumeTargetById : session claude morte → cwd + claudeSessionId + groupe ; null sinon', () => {
|
||||
const d1 = mkdtempSync(join(tmpdir(), 'arb-rt-'));
|
||||
try {
|
||||
const summary = manager.spawn({ cwd, command: 'claude', addDirs: [d1], groupId: 'grpR' });
|
||||
db.prepare('UPDATE sessions SET claude_session_id = ? WHERE id = ?').run('cs-resume', summary.id);
|
||||
// vivante → null (resume direct interdit ; fork passe par le même chemin)
|
||||
expect(manager.resumeTargetById(summary.id)).toBeNull();
|
||||
lastPty().emitExit(0);
|
||||
// morte avec claudeSessionId connu → cible complète
|
||||
expect(manager.resumeTargetById(summary.id)).toEqual({
|
||||
cwd,
|
||||
claudeSessionId: 'cs-resume',
|
||||
addedDirs: [d1],
|
||||
groupId: 'grpR',
|
||||
});
|
||||
// id inconnu → null
|
||||
expect(manager.resumeTargetById('nope')).toBeNull();
|
||||
} finally {
|
||||
rmSync(d1, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it('resumeTargetById : session bash morte (sans claudeSessionId) → null', () => {
|
||||
const { summary, pty } = spawnBash();
|
||||
pty.emitExit(0);
|
||||
expect(manager.resumeTargetById(summary.id)).toBeNull();
|
||||
});
|
||||
|
||||
it('capture le claudeSessionId via le registre (poll par pid) → findLiveByClaudeSessionId', () => {
|
||||
vi.useFakeTimers();
|
||||
const sessDir = mkdtempSync(join(tmpdir(), 'arb-sess-'));
|
||||
@@ -602,53 +574,4 @@ describe('PtyManager (pty mocké)', () => {
|
||||
expect(manager.attach(summary.id, makeBinding('interactive'), 80, 24)).toEqual({ ok: false, code: 'NOT_FOUND' });
|
||||
});
|
||||
});
|
||||
|
||||
describe('session de groupe multi-repo (P6)', () => {
|
||||
it('spawn avec addDirs : --add-dir au pty, addedDirs + groupId résumés et persistés', () => {
|
||||
const d1 = mkdtempSync(join(tmpdir(), 'arb-g1-'));
|
||||
const d2 = mkdtempSync(join(tmpdir(), 'arb-g2-'));
|
||||
try {
|
||||
const summary = manager.spawn({ cwd, command: 'claude', addDirs: [d1, d2], groupId: 'grp1' });
|
||||
expect(lastPty().args).toEqual(['--add-dir', d1, '--add-dir', d2]);
|
||||
expect(summary.addedDirs).toEqual([d1, d2]);
|
||||
expect(summary.groupId).toBe('grp1');
|
||||
const row = db.prepare('SELECT added_dirs, group_id FROM sessions WHERE id = ?').get(summary.id) as {
|
||||
added_dirs: string | null;
|
||||
group_id: string | null;
|
||||
};
|
||||
expect(JSON.parse(row.added_dirs as string)).toEqual([d1, d2]);
|
||||
expect(row.group_id).toBe('grp1');
|
||||
} finally {
|
||||
rmSync(d1, { recursive: true, force: true });
|
||||
rmSync(d2, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it('dédoublonne et écarte le cwd primaire des addDirs', () => {
|
||||
const d1 = mkdtempSync(join(tmpdir(), 'arb-g4-'));
|
||||
try {
|
||||
const summary = manager.spawn({ cwd, command: 'claude', addDirs: [d1, d1, cwd] });
|
||||
expect(summary.addedDirs).toEqual([d1]);
|
||||
} finally {
|
||||
rmSync(d1, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
it('rejette un addDir inexistant (400)', () => {
|
||||
expect(() => manager.spawn({ cwd, command: 'bash', addDirs: ['/no/such/dir/xyz-arb'] })).toThrow();
|
||||
});
|
||||
|
||||
it('groupSessionContext renvoie les addedDirs/groupId persistés (resume)', () => {
|
||||
const d1 = mkdtempSync(join(tmpdir(), 'arb-g5-'));
|
||||
try {
|
||||
const summary = manager.spawn({ cwd, command: 'claude', addDirs: [d1], groupId: 'grpX' });
|
||||
// simule la capture du claudeSessionId (normalement résolue via le registre)
|
||||
db.prepare('UPDATE sessions SET claude_session_id = ? WHERE id = ?').run('cs-1', summary.id);
|
||||
expect(manager.groupSessionContext('cs-1')).toEqual({ addedDirs: [d1], groupId: 'grpX' });
|
||||
expect(manager.groupSessionContext('unknown')).toBeNull();
|
||||
} finally {
|
||||
rmSync(d1, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,104 +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('descend dans une racine qui est elle-même un repo (workspace + sous-repos)', async () => {
|
||||
const root = tmpRoot();
|
||||
makeRepo(root); // la racine fournie contient elle-même un .git (cas WebstormProjects)
|
||||
makeRepo(root, 'a');
|
||||
makeRepo(root, 'b');
|
||||
const { paths } = await scanForRepos([root], limits);
|
||||
// la racine ET ses dépôts internes sont découverts (la racine n'arrête pas le scan)
|
||||
expect([...paths].sort()).toEqual([root, join(root, 'a'), join(root, 'b')].sort());
|
||||
});
|
||||
|
||||
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,37 +0,0 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { randomBytes } from 'node:crypto';
|
||||
import { SecretBox } from '../src/core/secret-box.js';
|
||||
|
||||
const box = (): SecretBox => new SecretBox(randomBytes(32));
|
||||
|
||||
describe('SecretBox', () => {
|
||||
it('chiffre puis déchiffre (round-trip)', () => {
|
||||
const b = box();
|
||||
const secret = 'deadbeef'.repeat(8);
|
||||
const enc = b.encrypt(secret);
|
||||
expect(enc.startsWith('v1:')).toBe(true);
|
||||
expect(enc).not.toContain(secret); // le clair n'apparaît pas
|
||||
expect(b.decrypt(enc)).toBe(secret);
|
||||
});
|
||||
|
||||
it('produit un chiffré différent à chaque fois (IV aléatoire)', () => {
|
||||
const b = box();
|
||||
expect(b.encrypt('x')).not.toBe(b.encrypt('x'));
|
||||
});
|
||||
|
||||
it('retourne tel quel une valeur en clair (legacy) et la détecte', () => {
|
||||
const b = box();
|
||||
expect(b.isEncrypted('plain-secret')).toBe(false);
|
||||
expect(b.decrypt('plain-secret')).toBe('plain-secret');
|
||||
expect(b.isEncrypted(b.encrypt('x'))).toBe(true);
|
||||
});
|
||||
|
||||
it('échoue si la clé ne correspond pas (GCM authentifié)', () => {
|
||||
const enc = box().encrypt('secret');
|
||||
expect(() => box().decrypt(enc)).toThrow();
|
||||
});
|
||||
|
||||
it('échoue sur un format chiffré corrompu', () => {
|
||||
expect(() => box().decrypt('v1:zzz')).toThrow();
|
||||
});
|
||||
});
|
||||
@@ -1,139 +0,0 @@
|
||||
// Routes Réglages : GET expose la config non sensible (jamais les secrets), PATCH n'écrit que
|
||||
// l'allow-list (découverte des dépôts) et ignore toute clé hors allow-list.
|
||||
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 aucune racine de scan 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
|
||||
// défauts de découverte : AUCUNE racine (clean install → pas de scan) + intervalle 5 min
|
||||
expect(body.settings.scanRoots).toEqual([]);
|
||||
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 — sécurité', () => {
|
||||
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: { scanRoots: ['/home/u/work'] } });
|
||||
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 { 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 { 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 { PtyManager } from '../src/core/pty-manager.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 });
|
||||
});
|
||||
|
||||
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' });
|
||||
run('init', '-b', 'main');
|
||||
run('config', 'user.email', 'test@arboretum.dev');
|
||||
@@ -42,21 +44,9 @@ function gitInit(dir: string): void {
|
||||
writeFileSync(join(dir, 'README.md'), '# test\n');
|
||||
run('add', '-A');
|
||||
run('commit', '-m', 'init');
|
||||
}
|
||||
|
||||
function makeTmpRepo(): string {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'arb-wtm-'));
|
||||
dirs.push(dir);
|
||||
gitInit(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', () => {
|
||||
let db: Db;
|
||||
let pty: PtyManager;
|
||||
@@ -116,46 +106,6 @@ describe('WorktreeManager', () => {
|
||||
await expect(wt.createWorktree(r.id, { branch: '../evil', newBranch: true })).rejects.toMatchObject({ statusCode: 400 });
|
||||
});
|
||||
|
||||
it('startMainSession : session dans le checkout principal (branche actuelle, sans mutation git)', async () => {
|
||||
const repo = makeTmpRepo();
|
||||
const r = await wt.addRepo({ path: repo });
|
||||
const out = await wt.startMainSession(r.id, { command: 'bash' });
|
||||
expect(resolve(out.session.cwd)).toBe(resolve(repo));
|
||||
expect(out.session).toMatchObject({ command: 'bash', live: true });
|
||||
// pas de bascule de branche → toujours sur main.
|
||||
expect(execFileSync('git', ['branch', '--show-current'], { cwd: repo }).toString().trim()).toBe('main');
|
||||
const main = (await wt.listRepoWorktrees(r.id, true)).find((w) => w.isMain);
|
||||
expect(main?.sessions.some((s) => s.id === out.session.id)).toBe(true);
|
||||
});
|
||||
|
||||
it('startMainSession : newBranch crée et bascule la branche dans le checkout principal + event', async () => {
|
||||
const repo = makeTmpRepo();
|
||||
const r = await wt.addRepo({ path: repo });
|
||||
const events: Array<{ worktree: WorktreeSummary }> = [];
|
||||
wt.on('worktree_update', (e) => events.push(e));
|
||||
const out = await wt.startMainSession(r.id, { command: 'bash', branch: 'feature/x', newBranch: true });
|
||||
expect(execFileSync('git', ['branch', '--show-current'], { cwd: repo }).toString().trim()).toBe('feature/x');
|
||||
expect(out.worktree?.branch).toBe('feature/x');
|
||||
expect(events.some((e) => e.worktree.isMain && e.worktree.branch === 'feature/x')).toBe(true);
|
||||
});
|
||||
|
||||
it('startMainSession : checkout principal sale → 409 DIRTY_TREE (pas de bascule)', async () => {
|
||||
const repo = makeTmpRepo();
|
||||
const r = await wt.addRepo({ path: repo });
|
||||
writeFileSync(join(repo, 'scratch.txt'), 'wip\n'); // arbre sale
|
||||
await expect(wt.startMainSession(r.id, { command: 'bash', branch: 'feature/y', newBranch: true })).rejects.toMatchObject({
|
||||
statusCode: 409,
|
||||
code: 'DIRTY_TREE',
|
||||
});
|
||||
expect(execFileSync('git', ['branch', '--show-current'], { cwd: repo }).toString().trim()).toBe('main');
|
||||
});
|
||||
|
||||
it('startMainSession : branche invalide → 400', async () => {
|
||||
const repo = makeTmpRepo();
|
||||
const r = await wt.addRepo({ path: repo });
|
||||
await expect(wt.startMainSession(r.id, { command: 'bash', branch: '../evil', newBranch: true })).rejects.toMatchObject({ statusCode: 400 });
|
||||
});
|
||||
|
||||
it('deleteWorktree : main refusé (400), dirty refusé (409) puis force OK', async () => {
|
||||
const repo = makeTmpRepo();
|
||||
const r = await wt.addRepo({ path: repo });
|
||||
@@ -194,79 +144,4 @@ describe('WorktreeManager', () => {
|
||||
pty.spawn({ cwd: wtPath, command: 'bash' });
|
||||
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).
|
||||
import type { GroupSummary, PostCreateHook, RepoSummary, SessionSummary, WorktreeSummary } from './protocol.js';
|
||||
import type { PostCreateHook, RepoSummary, SessionSummary, WorktreeSummary } from './protocol.js';
|
||||
|
||||
export interface ApiError {
|
||||
error: { code: string; message: string; details?: unknown };
|
||||
@@ -14,34 +14,10 @@ export interface LoginResponse {
|
||||
}
|
||||
export interface MeResponse {
|
||||
ok: true;
|
||||
/** id du token de la session courante — sert à marquer « courant » dans la liste des tokens. */
|
||||
tokenId: string;
|
||||
tokenLabel: 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 {
|
||||
cwd: string;
|
||||
/** binaire à lancer — défaut "claude" ; "bash" sert aux tests d'acceptation sans quota */
|
||||
@@ -76,19 +52,6 @@ export interface UpdateRepoRequest {
|
||||
label?: string;
|
||||
postCreateHooks?: PostCreateHook[];
|
||||
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 {
|
||||
@@ -128,79 +91,6 @@ export interface AdoptWorktreeRequest {
|
||||
preTrust?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* POST /api/v1/repos/:id/session — lance UNE session dans le checkout principal du repo
|
||||
* (`repo.path`) pour « bosser sur la branche principale » sans créer de worktree.
|
||||
* Réponse : `SessionResponse`.
|
||||
*/
|
||||
export interface StartRepoSessionRequest {
|
||||
/** binaire à lancer — défaut "claude" ; "bash" sert aux tests sans quota. */
|
||||
command?: 'claude' | 'bash';
|
||||
/** si fourni : crée/bascule cette branche dans le checkout principal avant la session. */
|
||||
branch?: string;
|
||||
/** true (défaut quand `branch` fourni) : `git switch -c` ; false : bascule sur une branche existante. */
|
||||
newBranch?: 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;
|
||||
}
|
||||
|
||||
// ---- Session de groupe multi-repo (P6) ----
|
||||
/** Lance UNE session Claude couvrant tous les repos du groupe (via `--add-dir`). */
|
||||
export interface CreateGroupSessionRequest {
|
||||
/** défaut : claude. */
|
||||
command?: 'claude' | 'bash';
|
||||
/** présent → couvre le worktree de cette branche dans chaque repo ; absent → les checkouts principaux. */
|
||||
branch?: string;
|
||||
}
|
||||
export interface GroupSessionResponse {
|
||||
session: SessionSummary;
|
||||
/** répertoires effectivement couverts par la session (cwd primaire en tête). */
|
||||
dirs: string[];
|
||||
/** repos du groupe pour lesquels aucun worktree n'a pu être résolu. */
|
||||
skipped: Array<{ repoId: string; reason: 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) ----
|
||||
export interface VapidKeyResponse {
|
||||
/** clé publique VAPID (applicationServerKey côté navigateur). */
|
||||
@@ -213,72 +103,3 @@ export interface PushSubscribeRequest {
|
||||
export interface PushUnsubscribeRequest {
|
||||
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: {
|
||||
/** racines absolues scannées pour la découverte auto des repos (défaut : aucune → pas de scan). */
|
||||
scanRoots: string[];
|
||||
/** intervalle du re-scan périodique en minutes ; 0 = périodique désactivé. */
|
||||
scanIntervalMin: number;
|
||||
};
|
||||
server: ServerInfo;
|
||||
}
|
||||
export interface UpdateSettingsRequest {
|
||||
/** 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;
|
||||
}
|
||||
|
||||
// ---- Journal d'audit (conformité entreprise) ----
|
||||
export interface AuditLogEntry {
|
||||
id: string;
|
||||
/** horodatage ISO 8601 */
|
||||
ts: string;
|
||||
/** tokenId de l'acteur, 'system' (auto) ou 'anonymous' (avant auth) */
|
||||
actor: string;
|
||||
/** verbe.objet, ex. 'token.create', 'settings.update' */
|
||||
action: string;
|
||||
resourceId: string | null;
|
||||
/** métadonnées non sensibles (jamais de secret) */
|
||||
details: unknown;
|
||||
result: string;
|
||||
}
|
||||
export interface AuditLogsResponse {
|
||||
entries: AuditLogEntry[];
|
||||
/** curseur de pagination (ts à passer en `before`) ; null si fin de liste. */
|
||||
nextBefore: string | null;
|
||||
}
|
||||
|
||||
// ---- RGPD : export / suppression des données liées au token authentifié ----
|
||||
export interface DataExportResponse {
|
||||
exportedAt: string;
|
||||
tokens: Array<{ id: string; label: string; createdAt: string; lastUsedAt: string | null; current: boolean }>;
|
||||
pushSubscriptions: Array<{ endpoint: string; userAgent: string | null; createdAt: string; lastOkAt: string | null }>;
|
||||
sessions: Array<{ id: string; cwd: string; command: string; title: string | null; createdAt: string; endedAt: string | null; exitCode: number | null }>;
|
||||
settings: { scanRoots: string[]; scanIntervalMin: number };
|
||||
}
|
||||
export interface DeleteMyDataRequest {
|
||||
/** code de confirmation renvoyé par un premier appel sans `confirm` ; doit être renvoyé pour exécuter. */
|
||||
confirm?: string;
|
||||
}
|
||||
export interface DeleteMyDataResponse {
|
||||
/** 'pending' = confirmation requise (renvoie `confirm`) ; 'done' = suppression effectuée. */
|
||||
status: 'pending' | 'done';
|
||||
confirm?: string;
|
||||
/** récapitulatif de ce qui sera/a été supprimé. */
|
||||
summary: { pushSubscriptions: number; tokenRevoked: boolean };
|
||||
}
|
||||
|
||||
@@ -113,11 +113,6 @@ export interface SessionSummary {
|
||||
waitingFor?: string | null;
|
||||
/** dialogue typé en cours (présent quand activity === 'waiting'). */
|
||||
dialog?: SessionDialog | null;
|
||||
// ---- P6 : session de groupe multi-repo (additif) ----
|
||||
/** répertoires supplémentaires couverts via `--add-dir` ; absent/[] pour une session mono-repo. */
|
||||
addedDirs?: string[];
|
||||
/** groupe propriétaire d'une session de groupe (couvre plusieurs repos) ; null/absent sinon. */
|
||||
groupId?: string | null;
|
||||
}
|
||||
|
||||
// ---- Worktrees & repos (P3) ----
|
||||
@@ -141,8 +136,6 @@ export interface RepoSummary {
|
||||
createdAt: string;
|
||||
/** false si le chemin n'est plus un repo git accessible. */
|
||||
valid: boolean;
|
||||
/** true = masqué du dashboard (conservé en DB → non ré-ajouté au re-scan). */
|
||||
hidden: boolean;
|
||||
}
|
||||
|
||||
export interface WorktreeGitStatus {
|
||||
@@ -167,22 +160,6 @@ export interface WorktreeSummary {
|
||||
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 ----
|
||||
export type ClientMessage =
|
||||
| { type: 'hello'; protocol: number }
|
||||
@@ -195,7 +172,7 @@ export type ClientMessage =
|
||||
| { type: 'answer'; channel: number; action: 'select' | 'confirm' | 'deny'; optionN?: number }
|
||||
| { type: 'resize'; channel: number; cols: number; rows: number }
|
||||
| { type: 'ack'; channel: number; bytes: number }
|
||||
| { type: 'sub'; topics: Array<'sessions' | 'worktrees' | 'groups'> }
|
||||
| { type: 'sub'; topics: Array<'sessions' | 'worktrees'> }
|
||||
| { type: 'ping' };
|
||||
|
||||
// ---- Messages serveur → client ----
|
||||
@@ -210,8 +187,6 @@ export type ServerMessage =
|
||||
| { type: 'repo_removed'; repoId: string }
|
||||
| { type: 'worktree_update'; repoId: string; worktree: WorktreeSummary }
|
||||
| { 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: 'pong' };
|
||||
|
||||
@@ -269,8 +244,8 @@ export function parseClientMessage(raw: string): ClientMessage | null {
|
||||
? { type: 'ack', channel: m.channel, bytes: m.bytes }
|
||||
: null;
|
||||
case 'sub':
|
||||
return Array.isArray(m.topics) && m.topics.every((t) => t === 'sessions' || t === 'worktrees' || t === 'groups')
|
||||
? { type: 'sub', topics: m.topics as Array<'sessions' | 'worktrees' | 'groups'> }
|
||||
return Array.isArray(m.topics) && m.topics.every((t) => t === 'sessions' || t === 'worktrees')
|
||||
? { type: 'sub', topics: m.topics as Array<'sessions' | 'worktrees'> }
|
||||
: null;
|
||||
case 'ping':
|
||||
return { type: 'ping' };
|
||||
|
||||
@@ -62,7 +62,7 @@ function assertInvariants(msg: ClientMessage): void {
|
||||
expect(msg.bytes).toBeGreaterThanOrEqual(0);
|
||||
break;
|
||||
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;
|
||||
case 'ping':
|
||||
break;
|
||||
@@ -117,14 +117,9 @@ describe('parseClientMessage — cas valides', () => {
|
||||
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","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: [] });
|
||||
});
|
||||
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="en" style="background-color: #09090b">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="color-scheme" content="dark" />
|
||||
<meta name="theme-color" content="#09090b" />
|
||||
|
||||
<title>Arboretum — Mission control for your AI coding agents</title>
|
||||
<meta
|
||||
name="description"
|
||||
content="Arboretum is a local-first daemon you launch with npx that serves a web dashboard to run and supervise many Claude Code sessions across git worktrees — from any device, even your phone."
|
||||
/>
|
||||
<link rel="canonical" href="https://git-arboretum.com/" />
|
||||
|
||||
<!-- Open Graph / Twitter -->
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="https://git-arboretum.com/" />
|
||||
<meta property="og:title" content="Arboretum — Mission control for your AI coding agents" />
|
||||
<meta
|
||||
property="og:description"
|
||||
content="Run and supervise many Claude Code sessions across every git worktree — from any device, even your phone."
|
||||
/>
|
||||
<meta property="og:site_name" content="Arboretum" />
|
||||
<meta property="og:image" content="https://git-arboretum.com/assets/og-cover.png" />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<meta property="og:image:height" content="630" />
|
||||
<meta property="og:image:alt" content="Arboretum — mission control for your AI coding agents" />
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="Arboretum — Mission control for your AI coding agents" />
|
||||
<meta
|
||||
name="twitter:description"
|
||||
content="Run and supervise many Claude Code sessions across every git worktree — from any device, even your phone."
|
||||
/>
|
||||
<meta name="twitter:image" content="https://git-arboretum.com/assets/og-cover.png" />
|
||||
|
||||
<!-- Icons -->
|
||||
<link rel="icon" type="image/svg+xml" href="/icon.svg" />
|
||||
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<!-- Polices JetBrains Mono self-host via @fontsource (importées dans src/main.ts). -->
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<noscript>
|
||||
<div style="padding: 24px; font-family: system-ui, sans-serif; color: #f4f4f5; text-align: center">
|
||||
Arboretum — mission control for your AI coding agents.
|
||||
<a href="https://git.lidge.fr/johanleroy/arboretum" style="color: #34d399">View on Gitea</a>.
|
||||
</div>
|
||||
</noscript>
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"name": "@arboretum/site",
|
||||
"private": true,
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vue-tsc --noEmit && vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"dependencies": {
|
||||
"vue": "^3.5.38",
|
||||
"vue-i18n": "^11.4.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fontsource/jetbrains-mono": "^5.1.0",
|
||||
"@tailwindcss/vite": "^4.3.0",
|
||||
"@vitejs/plugin-vue": "^6.0.7",
|
||||
"tailwindcss": "^4.3.0",
|
||||
"typescript": "^5.7.0",
|
||||
"vite": "^8.0.16",
|
||||
"vue-tsc": "^3.3.4"
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
# git-arboretum.com — site vitrine statique (Vue 3 / Vite).
|
||||
#
|
||||
# Google PageSpeed (mod_pagespeed) renvoie un corps HTML VIDE sur ce domaine Plesk
|
||||
# (la home répond 200 mais 0 octet → page blanche), alors que les assets statiques
|
||||
# passent. Les bundles Vite sont déjà minifiés, hashés et gzippés : PageSpeed
|
||||
# n'apporte rien ici et casse le rendu. On le désactive pour ce vhost.
|
||||
#
|
||||
# NB : si l'hébergement interdit ces directives en .htaccess (AllowOverride
|
||||
# restrictif), Apache renverra une 500 → dans ce cas, supprimer ce fichier et
|
||||
# désactiver PageSpeed depuis Plesk (Apache & nginx Settings).
|
||||
<IfModule pagespeed_module>
|
||||
ModPagespeed off
|
||||
</IfModule>
|
||||
<IfModule ngx_pagespeed_module>
|
||||
pagespeed off;
|
||||
</IfModule>
|
||||
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 28 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 5.5 KiB |
@@ -1,46 +0,0 @@
|
||||
<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"/>
|
||||
|
||||
<!-- branches / circuit (tronc + fourches symétriques), tracées dans la zone sûre maskable -->
|
||||
<g fill="none" stroke="url(#branch)" stroke-width="17" stroke-linecap="round" stroke-linejoin="round" filter="url(#glow)">
|
||||
<!-- tronc : du nœud sommet jusqu'à la base avec le curseur >_ -->
|
||||
<path d="M256 96 V392"/>
|
||||
<!-- paire haute -->
|
||||
<path d="M256 232 L150 232 V150"/>
|
||||
<path d="M256 232 L362 232 V150"/>
|
||||
<!-- 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>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1,4 +0,0 @@
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
Sitemap: https://git-arboretum.com/sitemap.xml
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
<url>
|
||||
<loc>https://git-arboretum.com/</loc>
|
||||
<lastmod>2026-06-19</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
</urlset>
|
||||
@@ -1,74 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import AppHeader from './components/AppHeader.vue';
|
||||
import HeroSection from './components/HeroSection.vue';
|
||||
import ProblemSection from './components/ProblemSection.vue';
|
||||
import FeaturesSection from './components/FeaturesSection.vue';
|
||||
import ShowcaseSection from './components/ShowcaseSection.vue';
|
||||
import WorkGroupsSection from './components/WorkGroupsSection.vue';
|
||||
import HowItWorksSection from './components/HowItWorksSection.vue';
|
||||
import SecuritySection from './components/SecuritySection.vue';
|
||||
import FaqSection from './components/FaqSection.vue';
|
||||
import FinalCta from './components/FinalCta.vue';
|
||||
import AppFooter from './components/AppFooter.vue';
|
||||
|
||||
const { locale } = useI18n();
|
||||
|
||||
// Tient l'attribut <html lang> synchronisé avec la langue active.
|
||||
watch(
|
||||
locale,
|
||||
(l) => {
|
||||
document.documentElement.lang = l;
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
// Grain de fond + halo emerald (décoratifs) — portés tels quels du design.
|
||||
const grainStyle = {
|
||||
position: 'fixed',
|
||||
inset: '0',
|
||||
zIndex: 0,
|
||||
pointerEvents: 'none',
|
||||
backgroundImage: 'radial-gradient(rgba(255,255,255,.025) 1px,transparent 1.4px)',
|
||||
backgroundSize: '34px 34px',
|
||||
WebkitMaskImage: 'radial-gradient(ellipse 120% 70% at 50% -4%,#000,transparent 70%)',
|
||||
maskImage: 'radial-gradient(ellipse 120% 70% at 50% -4%,#000,transparent 70%)',
|
||||
} as const;
|
||||
|
||||
const glowStyle = {
|
||||
position: 'fixed',
|
||||
top: '-26%',
|
||||
left: '50%',
|
||||
transform: 'translateX(-50%)',
|
||||
width: '1100px',
|
||||
height: '680px',
|
||||
zIndex: 0,
|
||||
pointerEvents: 'none',
|
||||
background: 'radial-gradient(50% 50% at 50% 50%,rgba(16,185,129,.12),transparent 64%)',
|
||||
filter: 'blur(18px)',
|
||||
} as const;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative overflow-x-hidden">
|
||||
<div aria-hidden="true" :style="grainStyle"></div>
|
||||
<div aria-hidden="true" :style="glowStyle"></div>
|
||||
|
||||
<AppHeader />
|
||||
|
||||
<main id="top" class="relative z-[1]">
|
||||
<HeroSection />
|
||||
<ProblemSection />
|
||||
<FeaturesSection />
|
||||
<ShowcaseSection />
|
||||
<WorkGroupsSection />
|
||||
<HowItWorksSection />
|
||||
<SecuritySection />
|
||||
<FaqSection />
|
||||
<FinalCta />
|
||||
</main>
|
||||
|
||||
<AppFooter />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,50 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { INSTALL_COMMAND } from '../composables/useCopy';
|
||||
import { REPO, LICENSE, COFFEE } from '../lib/links';
|
||||
import IconGitea from './icons/IconGitea.vue';
|
||||
import CopyButton from './CopyButton.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<footer class="relative z-[1] border-t border-[#1c1c1f]">
|
||||
<div class="mx-auto flex max-w-[1200px] flex-wrap items-center justify-between gap-5 px-6 py-[34px]">
|
||||
<div class="flex items-center gap-[11px]">
|
||||
<img
|
||||
src="/assets/arboretum-mark.png"
|
||||
alt=""
|
||||
width="22"
|
||||
height="22"
|
||||
class="h-[22px] w-[22px] object-contain"
|
||||
style="filter: grayscale(1) brightness(1.5); opacity: 0.4"
|
||||
/>
|
||||
<span class="font-mono text-sm text-zinc-300">git-arboretum.com</span>
|
||||
<span class="ml-1 text-[13px] text-zinc-600">— {{ t('footTag') }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-[22px] text-sm">
|
||||
<a :href="REPO" target="_blank" rel="noopener" class="inline-flex items-center gap-1.5 text-zinc-400 no-underline transition-colors hover:text-emerald-400">
|
||||
<IconGitea :size="15" />
|
||||
Gitea
|
||||
</a>
|
||||
<a :href="LICENSE" target="_blank" rel="noopener" class="text-zinc-400 no-underline transition-colors hover:text-emerald-400">
|
||||
{{ t('license') }}
|
||||
</a>
|
||||
<a
|
||||
:href="COFFEE"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="inline-flex items-center gap-1.5 text-zinc-400 no-underline transition-colors hover:text-amber-400 focus-visible:rounded-md focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-amber-400/70"
|
||||
>
|
||||
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 2v2" /><path d="M14 2v2" /><path d="M5 8h13a1 1 0 0 1 1 1v2a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1Z" /><path d="M6 15a4 4 0 0 0 4 4h2a4 4 0 0 0 4-4" /><path d="M19 9h1.5a2.5 2.5 0 0 1 0 5H18" /></svg>
|
||||
{{ t('coffee') }}
|
||||
</a>
|
||||
<div class="flex items-center gap-2">
|
||||
<code class="font-mono text-[12.5px] text-zinc-600">{{ INSTALL_COMMAND }}</code>
|
||||
<CopyButton variant="icon" :text="INSTALL_COMMAND" :label="t('copyCommand')" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
</template>
|
||||
@@ -1,59 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { REPO } from '../lib/links';
|
||||
import LangToggle from './LangToggle.vue';
|
||||
import IconGitea from './icons/IconGitea.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const navLinks = [
|
||||
{ href: '#features', key: 'navFeatures' },
|
||||
{ href: '#how', key: 'navHow' },
|
||||
{ href: '#security', key: 'navSecurity' },
|
||||
{ href: '#faq', key: 'navFaq' },
|
||||
] as const;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header
|
||||
class="sticky top-0 z-50 border-b border-[#1c1c1f] bg-[rgba(9,9,11,0.72)] backdrop-blur-[14px]"
|
||||
>
|
||||
<div class="mx-auto flex h-16 max-w-[1200px] items-center justify-between gap-6 px-6">
|
||||
<a href="#top" class="flex items-center gap-2.5 text-zinc-100 no-underline">
|
||||
<img
|
||||
src="/assets/arboretum-mark.png"
|
||||
alt="Arboretum"
|
||||
width="28"
|
||||
height="28"
|
||||
class="block h-7 w-7 object-contain"
|
||||
/>
|
||||
<span class="font-mono text-[17px] font-semibold tracking-[-0.01em]">Arboretum</span>
|
||||
</a>
|
||||
|
||||
<nav class="hidden items-center gap-[30px] min-[900px]:flex">
|
||||
<a
|
||||
v-for="link in navLinks"
|
||||
:key="link.href"
|
||||
:href="link.href"
|
||||
class="text-[14.5px] text-zinc-400 no-underline transition-colors hover:text-zinc-100"
|
||||
>
|
||||
{{ t(link.key) }}
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
<div class="flex items-center gap-3.5">
|
||||
<LangToggle />
|
||||
<a
|
||||
:href="REPO"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
aria-label="Gitea"
|
||||
class="inline-flex items-center gap-[7px] rounded-lg border border-zinc-800 px-[13px] py-[7px] text-[13.5px] font-medium text-zinc-300 no-underline transition-colors hover:border-emerald-500/50 hover:text-emerald-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-500/70"
|
||||
>
|
||||
<IconGitea :size="16" />
|
||||
Gitea
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
@@ -1,57 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useCopy } from '../composables/useCopy';
|
||||
import IconCopy from './icons/IconCopy.vue';
|
||||
import IconCheck from './icons/IconCheck.vue';
|
||||
|
||||
// Bouton « copier » réutilisable, avec retour visuel (icône ✓ + label) pendant 1800 ms.
|
||||
// Deux variantes :
|
||||
// - 'bar' : bouton étiqueté intégré aux barres de commande (hero, CTA final).
|
||||
// - 'icon' : bouton compact icône seule, pour les blocs de code (étapes, footer).
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
text: string;
|
||||
variant?: 'bar' | 'icon';
|
||||
label?: string; // aria-label décrivant ce qui est copié
|
||||
barClass?: string; // padding/ajustements de la variante 'bar'
|
||||
}>(),
|
||||
{ variant: 'bar', label: '', barClass: 'px-[15px]' },
|
||||
);
|
||||
|
||||
const { t } = useI18n();
|
||||
const { copied, copy } = useCopy();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<button
|
||||
v-if="variant === 'bar'"
|
||||
type="button"
|
||||
:aria-label="label || t('copy')"
|
||||
:class="[
|
||||
'inline-flex flex-none items-center gap-[7px] border-l border-zinc-800 bg-zinc-900 font-mono text-[13px] font-semibold transition-colors hover:bg-zinc-800 hover:text-emerald-400 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-emerald-500/70',
|
||||
barClass,
|
||||
copied ? 'text-emerald-400' : 'text-zinc-300',
|
||||
]"
|
||||
@click="copy(text)"
|
||||
>
|
||||
<component :is="copied ? IconCheck : IconCopy" :size="15" />
|
||||
<span aria-live="polite">{{ copied ? t('copied') : t('copy') }}</span>
|
||||
</button>
|
||||
|
||||
<button
|
||||
v-else
|
||||
type="button"
|
||||
:aria-label="label || t('copy')"
|
||||
:title="copied ? t('copied') : label || t('copy')"
|
||||
:class="[
|
||||
'inline-flex flex-none items-center justify-center rounded-md border p-1.5 transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-500/70',
|
||||
copied
|
||||
? 'border-emerald-500/40 bg-zinc-800 text-emerald-400'
|
||||
: 'border-zinc-800 bg-zinc-900/80 text-zinc-400 hover:border-emerald-500/40 hover:bg-zinc-800 hover:text-emerald-400',
|
||||
]"
|
||||
@click="copy(text)"
|
||||
>
|
||||
<component :is="copied ? IconCheck : IconCopy" :size="14" />
|
||||
<span aria-live="polite" class="sr-only">{{ copied ? t('copied') : t('copy') }}</span>
|
||||
</button>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { FAQS } from '../i18n/content';
|
||||
import type { AppLocale } from '../i18n';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
const open = ref(0);
|
||||
const items = computed(() => FAQS[locale.value as AppLocale]);
|
||||
|
||||
function toggle(i: number): void {
|
||||
open.value = open.value === i ? -1 : i;
|
||||
}
|
||||
|
||||
function panelStyle(i: number) {
|
||||
return {
|
||||
maxHeight: open.value === i ? '300px' : '0px',
|
||||
opacity: open.value === i ? 1 : 0,
|
||||
overflow: 'hidden',
|
||||
transition: 'max-height .4s ease, opacity .35s ease',
|
||||
} as const;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section id="faq" class="mx-auto max-w-[780px] scroll-mt-[84px] px-6 pb-[100px]">
|
||||
<div v-reveal class="mb-[38px] text-center">
|
||||
<div class="mb-3.5 font-mono text-xs uppercase tracking-[0.14em] text-emerald-400">{{ t('navFaq') }}</div>
|
||||
<h2 class="m-0 text-[clamp(28px,3.4vw,40px)] font-semibold tracking-[-0.025em] text-zinc-50">{{ t('faqTitle') }}</h2>
|
||||
</div>
|
||||
|
||||
<div v-reveal>
|
||||
<div v-for="(f, i) in items" :key="i" class="border-t" :class="open === i ? 'border-emerald-400/40' : 'border-zinc-800'">
|
||||
<button
|
||||
type="button"
|
||||
:aria-expanded="open === i"
|
||||
:aria-controls="`faq-panel-${i}`"
|
||||
class="flex w-full cursor-pointer items-center justify-between gap-4 border-none bg-transparent px-1 py-5 text-left text-[clamp(16px,2vw,18px)] font-medium text-zinc-50 focus-visible:rounded-md focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-500/70"
|
||||
@click="toggle(i)"
|
||||
>
|
||||
<span>{{ f.q }}</span>
|
||||
<span class="flex flex-none text-emerald-400 transition-transform duration-300" :class="open === i ? 'rotate-180' : ''">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="#34d399" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m6 9 6 6 6-6" /></svg>
|
||||
</span>
|
||||
</button>
|
||||
<div :id="`faq-panel-${i}`" :style="panelStyle(i)" :inert="open !== i" :aria-hidden="open !== i">
|
||||
<p class="m-0 max-w-[640px] px-1 pb-5 text-[15.5px] leading-[1.6] text-zinc-400">{{ f.a }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,17 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
defineProps<{ title: string }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="rounded-xl border border-zinc-800 bg-zinc-900/50 p-6 transition-[transform,border-color] duration-[180ms] ease-in-out hover:-translate-y-[3px] hover:border-emerald-400/40"
|
||||
>
|
||||
<div
|
||||
class="mb-4 inline-flex h-[42px] w-[42px] items-center justify-center rounded-[10px] bg-emerald-500/10 text-emerald-400"
|
||||
>
|
||||
<slot name="icon" />
|
||||
</div>
|
||||
<h3 class="m-0 mb-[7px] text-lg font-semibold text-zinc-50">{{ title }}</h3>
|
||||
<p class="m-0 text-[14.5px] leading-[1.55] text-zinc-400"><slot /></p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,76 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import FeatureCard from './FeatureCard.vue';
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section id="features" class="mx-auto max-w-[1200px] scroll-mt-[84px] px-6 pb-[100px]">
|
||||
<div v-reveal class="mb-[46px] text-center">
|
||||
<div class="mb-3.5 font-mono text-xs uppercase tracking-[0.14em] text-emerald-400">{{ t('featKicker') }}</div>
|
||||
<h2 class="m-0 text-[clamp(28px,3.4vw,40px)] font-semibold tracking-[-0.025em] text-zinc-50">
|
||||
{{ t('featTitle') }}
|
||||
</h2>
|
||||
</div>
|
||||
|
||||
<div v-reveal class="grid grid-cols-[repeat(auto-fit,minmax(264px,1fr))] gap-4">
|
||||
<FeatureCard :title="t('feat1Title')">
|
||||
<template #icon>
|
||||
<svg width="21" height="21" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="6" y1="3" x2="6" y2="15" /><circle cx="18" cy="6" r="3" /><circle cx="6" cy="18" r="3" /><path d="M18 9a9 9 0 0 1-9 9" /></svg>
|
||||
</template>
|
||||
{{ t('feat1Desc') }}
|
||||
</FeatureCard>
|
||||
|
||||
<FeatureCard :title="t('feat2Title')">
|
||||
<template #icon>
|
||||
<svg width="21" height="21" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="7" height="7" x="3" y="3" rx="1" /><rect width="7" height="7" x="14" y="3" rx="1" /><rect width="7" height="7" x="14" y="14" rx="1" /><rect width="7" height="7" x="3" y="14" rx="1" /></svg>
|
||||
</template>
|
||||
{{ t('feat2Desc') }}
|
||||
</FeatureCard>
|
||||
|
||||
<FeatureCard :title="t('feat3Title')">
|
||||
<template #icon>
|
||||
<svg width="21" height="21" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 12h-4l-3 9L9 3l-3 9H2" /></svg>
|
||||
</template>
|
||||
<span class="text-sky-300">{{ t('busy') }}</span> ·
|
||||
<span class="text-amber-300">{{ t('waiting') }}</span> ·
|
||||
<span class="text-emerald-400">{{ t('idle') }}</span> — {{ t('feat3Desc') }}
|
||||
</FeatureCard>
|
||||
|
||||
<FeatureCard :title="t('feat4Title')">
|
||||
<template #icon>
|
||||
<svg width="21" height="21" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="14" height="20" x="5" y="2" rx="2.5" /><path d="M12 18h.01" /></svg>
|
||||
</template>
|
||||
{{ t('feat4Desc') }}
|
||||
</FeatureCard>
|
||||
|
||||
<FeatureCard :title="t('feat5Title')">
|
||||
<template #icon>
|
||||
<svg width="21" height="21" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10.27 21a1.94 1.94 0 0 0 3.46 0" /><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" /></svg>
|
||||
</template>
|
||||
{{ t('feat5Desc') }}
|
||||
</FeatureCard>
|
||||
|
||||
<FeatureCard :title="t('feat6Title')">
|
||||
<template #icon>
|
||||
<svg width="21" height="21" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" /></svg>
|
||||
</template>
|
||||
{{ t('feat6Desc') }}
|
||||
</FeatureCard>
|
||||
|
||||
<FeatureCard :title="t('feat7Title')">
|
||||
<template #icon>
|
||||
<svg width="21" height="21" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z" /><path d="m7 16.5-4.74-2.85" /><path d="m7 16.5 5-3" /><path d="M7 16.5v5.17" /><path d="M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z" /><path d="m17 16.5 4.74-2.85" /><path d="M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z" /></svg>
|
||||
</template>
|
||||
{{ t('feat7Desc') }}
|
||||
</FeatureCard>
|
||||
|
||||
<FeatureCard :title="t('feat8Title')">
|
||||
<template #icon>
|
||||
<svg width="21" height="21" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" /></svg>
|
||||
</template>
|
||||
{{ t('feat8Desc') }}
|
||||
</FeatureCard>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,52 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { INSTALL_COMMAND } from '../composables/useCopy';
|
||||
import { REPO } from '../lib/links';
|
||||
import IconGitea from './icons/IconGitea.vue';
|
||||
import CopyButton from './CopyButton.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="mx-auto max-w-[1200px] px-6 pb-[100px]">
|
||||
<div
|
||||
v-reveal
|
||||
class="rounded-[20px] border border-zinc-800 px-6 py-[clamp(36px,5vw,64px)] text-center"
|
||||
style="background: radial-gradient(120% 140% at 50% 0%, rgba(16, 185, 129, 0.1), transparent 60%), #0c0c0e"
|
||||
>
|
||||
<img
|
||||
src="/assets/arboretum-mark.png"
|
||||
alt=""
|
||||
width="52"
|
||||
height="52"
|
||||
class="mx-auto mb-5 block h-[52px] w-[52px] object-contain"
|
||||
/>
|
||||
<h2 class="m-0 mb-3.5 text-[clamp(30px,4vw,46px)] font-bold leading-[1.08] tracking-[-0.03em] text-zinc-50">
|
||||
{{ t('ctaTitle') }}
|
||||
</h2>
|
||||
<p class="mx-auto mb-7 max-w-[480px] text-[17px] text-zinc-400">{{ t('ctaBody') }}</p>
|
||||
|
||||
<div
|
||||
class="mx-auto flex max-w-[460px] items-stretch overflow-hidden rounded-[10px] border border-zinc-800 bg-zinc-950"
|
||||
>
|
||||
<div class="flex min-w-0 flex-1 items-center gap-2.5 overflow-x-auto whitespace-nowrap px-4 font-mono text-sm">
|
||||
<span class="text-emerald-400">$</span><span class="text-zinc-200">{{ INSTALL_COMMAND }}</span>
|
||||
</div>
|
||||
<CopyButton variant="bar" :text="INSTALL_COMMAND" :label="t('copyCommand')" bar-class="px-4" />
|
||||
</div>
|
||||
|
||||
<div class="mt-[18px]">
|
||||
<a
|
||||
:href="REPO"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="inline-flex items-center gap-2 text-[14.5px] text-zinc-400 no-underline transition-colors hover:text-emerald-400"
|
||||
>
|
||||
<IconGitea :size="16" />
|
||||
{{ t('ctaSource') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,218 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useHeroTimeline, type SessionState } from '../composables/useHeroTimeline';
|
||||
import { DLG_OPTS } from '../i18n/content';
|
||||
import type { AppLocale } from '../i18n';
|
||||
import IconGitea from './icons/IconGitea.vue';
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
const { anim } = useHeroTimeline('hero-stage');
|
||||
|
||||
// Couleurs des lignes de terminal par type (porté de renderVals.C).
|
||||
const LINE_COLORS: Record<string, string> = {
|
||||
cmd: '#52525b',
|
||||
tool: '#a1a1aa',
|
||||
edit: '#34d399',
|
||||
add: '#34d399',
|
||||
del: '#f87171',
|
||||
ok: '#34d399',
|
||||
warn: '#fcd34d',
|
||||
run: '#7dd3fc',
|
||||
};
|
||||
|
||||
// Couleurs alignées sur SessionStateBadge de l'app (zinc/emerald/amber/sky de Tailwind).
|
||||
const PILL: Record<SessionState, { bg: string; fg: string; dot: string; pulse: string }> = {
|
||||
idle: { bg: '#022c22', fg: '#34d399', dot: '#34d399', pulse: '' },
|
||||
busy: { bg: '#082f49', fg: '#7dd3fc', dot: '#7dd3fc', pulse: 'pulseSky 2s ease-in-out infinite' },
|
||||
waiting: { bg: '#451a03', fg: '#fcd34d', dot: '#fcd34d', pulse: 'pulseAmber 2.2s ease-in-out infinite' },
|
||||
};
|
||||
|
||||
const pill = computed(() => PILL[anim.value.sess]);
|
||||
const sessText = computed(() => t(anim.value.sess));
|
||||
|
||||
const termLines = computed(() =>
|
||||
anim.value.lines.map((l) => ({ text: l.text, color: LINE_COLORS[l.k] ?? '#d4d4d8' })),
|
||||
);
|
||||
|
||||
// Options du dialogue de permission — reproduit DialogPrompt (boutons numérotés + Deny).
|
||||
const dlgOptions = computed(() =>
|
||||
DLG_OPTS[locale.value as AppLocale].map((txt, i) => ({
|
||||
num: anim.value.ans === i ? '✓' : String(i + 1),
|
||||
text: txt,
|
||||
highlighted: anim.value.hl === i,
|
||||
answered: anim.value.ans === i,
|
||||
})),
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="hero-stage" class="relative min-w-[300px] flex-[1_1_480px]">
|
||||
<div
|
||||
class="relative overflow-hidden rounded-[14px] border border-zinc-800 bg-zinc-950 shadow-hero"
|
||||
>
|
||||
<!-- barre de fenêtre -->
|
||||
<div class="flex items-center gap-2 border-b border-[#1c1c1f] bg-[#0c0c0e] px-[14px] py-[11px]">
|
||||
<span class="h-2.5 w-2.5 rounded-full bg-zinc-700"></span>
|
||||
<span class="h-2.5 w-2.5 rounded-full bg-zinc-700"></span>
|
||||
<span class="h-2.5 w-2.5 rounded-full bg-zinc-700"></span>
|
||||
<span class="ml-2 font-mono text-[11.5px] text-zinc-600">arboretum · localhost:7317</span>
|
||||
</div>
|
||||
|
||||
<div class="flex min-h-[440px]">
|
||||
<!-- sidebar (fidèle à AppSidebar : Worktrees / Sessions / Groups, puis Réglages / Aide / Gitea / Café) -->
|
||||
<div
|
||||
class="flex w-[190px] flex-none flex-col border-r border-[#1c1c1f] bg-zinc-900/40 px-2 py-3"
|
||||
>
|
||||
<div class="flex items-center gap-2 px-2 pb-3">
|
||||
<img
|
||||
src="/assets/arboretum-mark.png"
|
||||
alt=""
|
||||
width="22"
|
||||
height="22"
|
||||
class="h-[22px] w-[22px] object-contain"
|
||||
/>
|
||||
<span class="text-[14px] font-semibold text-zinc-100">Arboretum</span>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="mb-2 flex items-center gap-2 rounded-lg border border-zinc-800 bg-zinc-950/40 px-2.5 py-1.5"
|
||||
>
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="#52525b" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8" /><path d="m21 21-4.3-4.3" /></svg>
|
||||
<span class="flex-1 text-[12px] text-zinc-500">{{ t('mSearch') }}</span>
|
||||
<span class="rounded border border-zinc-700 px-[5px] py-px font-mono text-[10px] text-zinc-500">⌘K</span>
|
||||
</div>
|
||||
|
||||
<!-- nav primaire -->
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex items-center gap-2.5 rounded-lg bg-zinc-800 px-2.5 py-1.5 text-zinc-100">
|
||||
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="6" x2="6" y1="3" y2="15" /><circle cx="18" cy="6" r="3" /><circle cx="6" cy="18" r="3" /><path d="M18 9a9 9 0 0 1-9 9" /></svg>
|
||||
<span class="flex-1 text-[12.5px] font-medium">{{ t('mWorktrees') }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-zinc-400">
|
||||
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m7 11 2-2-2-2" /><path d="M11 13h4" /><rect width="18" height="18" x="3" y="3" rx="2" ry="2" /></svg>
|
||||
<span class="flex-1 text-[12.5px] font-medium">{{ t('mSessions') }}</span>
|
||||
<span
|
||||
v-show="anim.att > 0"
|
||||
class="rounded-full bg-amber-500/20 px-1.5 text-[11px] font-semibold text-amber-300"
|
||||
>{{ anim.att }}</span
|
||||
>
|
||||
</div>
|
||||
<div class="flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-zinc-400">
|
||||
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z" /><path d="M7 16.5 12 13.5" /><path d="M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z" /><path d="m17 16.5 4.74-2.85" /><path d="M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0z" /></svg>
|
||||
<span class="flex-1 text-[12.5px] font-medium">{{ t('mGroups') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1"></div>
|
||||
|
||||
<!-- nav secondaire -->
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-zinc-400">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z" /><circle cx="12" cy="12" r="3" /></svg>
|
||||
<span class="flex-1 text-[12.5px] font-medium">{{ t('mSettings') }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-zinc-400">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10" /><path d="m4.93 4.93 4.24 4.24" /><path d="m14.83 9.17 4.24-4.24" /><path d="m14.83 14.83 4.24 4.24" /><path d="m9.17 14.83-4.24 4.24" /><circle cx="12" cy="12" r="4" /></svg>
|
||||
<span class="flex-1 text-[12.5px] font-medium">{{ t('mHelp') }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-zinc-400">
|
||||
<IconGitea :size="16" />
|
||||
<span class="flex-1 text-[12.5px] font-medium">{{ t('mGitea') }}</span>
|
||||
</div>
|
||||
<div class="flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-zinc-400">
|
||||
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 2v2" /><path d="M14 2v2" /><path d="M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1" /><path d="M6 2v2" /></svg>
|
||||
<span class="flex-1 text-[12.5px] font-medium">{{ t('coffee') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- pied : langue · notifications · déconnexion + version (fidèle à AppShellFooter) -->
|
||||
<div class="mt-2 flex items-center gap-2 border-t border-[#1c1c1f] px-1 pt-2.5">
|
||||
<span class="rounded border border-zinc-700 px-1.5 py-px font-mono text-[10px] text-zinc-400">{{ locale.toUpperCase() }}</span>
|
||||
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#34d399" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10.268 21a2 2 0 0 0 3.464 0" /><path d="M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326" /></svg>
|
||||
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="#71717a" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" /><polyline points="16 17 21 12 16 7" /><line x1="21" x2="9" y1="12" y2="12" /></svg>
|
||||
<span class="ml-auto font-mono text-[10px] text-zinc-600">v1.6.0</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- main -->
|
||||
<div class="flex min-w-0 flex-1 flex-col gap-[11px] p-[13px]">
|
||||
<!-- terminal pane -->
|
||||
<div
|
||||
class="flex min-h-0 flex-1 flex-col overflow-hidden rounded-[10px] border border-zinc-800 bg-zinc-950"
|
||||
>
|
||||
<div class="flex items-center justify-between border-b border-[#1c1c1f] px-[11px] py-2">
|
||||
<span class="font-mono text-[11.5px] text-zinc-300">api · feat/auth</span>
|
||||
<span
|
||||
class="inline-flex items-center gap-1.5 rounded px-2 py-[3px] font-mono text-[11px]"
|
||||
:style="{ background: pill.bg, color: pill.fg }"
|
||||
>
|
||||
<span
|
||||
class="h-1.5 w-1.5 flex-none rounded-full"
|
||||
:style="{ background: pill.dot, animation: pill.pulse }"
|
||||
></span>
|
||||
{{ sessText }}
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
class="flex min-h-[150px] flex-1 flex-col justify-end overflow-hidden p-[11px] font-mono text-xs leading-[1.7] text-zinc-300"
|
||||
>
|
||||
<div v-for="(ln, i) in termLines" :key="i" :style="{ color: ln.color, whiteSpace: 'pre' }">
|
||||
{{ ln.text }}
|
||||
</div>
|
||||
<div v-if="anim.cur">
|
||||
<span class="text-emerald-400">$</span>
|
||||
<span class="ml-1 inline-block h-[13px] w-[7px] animate-blink align-middle bg-zinc-200"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- dialogue de permission (fidèle à DialogPrompt : badge type + question + options + Deny) -->
|
||||
<div
|
||||
v-if="anim.dlg"
|
||||
class="animate-dlg-in rounded-lg border border-amber-900/60 bg-amber-950/30 p-[11px]"
|
||||
>
|
||||
<div class="mb-2 flex items-center gap-2">
|
||||
<span class="inline-flex items-center rounded bg-amber-900 px-1.5 py-0.5 text-[11px] font-medium text-amber-200">{{ t('mPermission') }}</span>
|
||||
<span class="text-[12.5px] text-amber-100">{{ t('dlgQ') }}</span>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-[6px]">
|
||||
<span
|
||||
v-for="(op, i) in dlgOptions"
|
||||
:key="i"
|
||||
class="inline-flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs font-medium transition-colors"
|
||||
:class="op.answered
|
||||
? 'border-emerald-500/70 bg-emerald-950/50 text-emerald-300'
|
||||
: op.highlighted
|
||||
? 'border-amber-400 bg-amber-950/50 text-amber-200'
|
||||
: 'border-zinc-700 bg-zinc-800 text-zinc-200'"
|
||||
>
|
||||
<span class="font-mono" :class="op.answered ? 'text-emerald-400' : 'text-amber-400'">{{ op.num }}</span>
|
||||
{{ op.text }}
|
||||
</span>
|
||||
<span class="inline-flex items-center rounded-lg border border-red-900 bg-red-950 px-2.5 py-1.5 text-xs font-medium text-red-300">{{ t('mDeny') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- toast push -->
|
||||
<div
|
||||
v-if="anim.toast"
|
||||
class="animate-toast-in absolute bottom-[14px] right-[14px] flex w-[248px] items-start gap-2.5 rounded-[11px] border border-[rgba(120,53,15,0.5)] bg-[#0c0c0e] p-3 shadow-toast"
|
||||
>
|
||||
<span class="inline-flex h-[30px] w-[30px] flex-none items-center justify-center rounded-lg bg-emerald-500/15">
|
||||
<img src="/assets/arboretum-mark.png" alt="" width="18" height="18" class="h-[18px] w-[18px] object-contain" />
|
||||
</span>
|
||||
<div class="min-w-0 flex-1">
|
||||
<div class="flex items-center justify-between">
|
||||
<span class="font-mono text-[11px] text-emerald-400">Arboretum</span>
|
||||
<span class="text-[10px] text-zinc-600">now</span>
|
||||
</div>
|
||||
<div class="mt-[3px] text-[13px] font-semibold text-zinc-100">{{ t('toastTitle') }}</div>
|
||||
<div class="mt-px text-[11.5px] leading-[1.4] text-zinc-400">{{ t('toastBody') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,71 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { INSTALL_COMMAND } from '../composables/useCopy';
|
||||
import { REPO } from '../lib/links';
|
||||
import HeroMockup from './HeroMockup.vue';
|
||||
import IconGitea from './icons/IconGitea.vue';
|
||||
import CopyButton from './CopyButton.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="mx-auto flex max-w-[1200px] flex-wrap items-center gap-12 px-6 pb-16 pt-[72px]">
|
||||
<div class="min-w-[300px] flex-[1_1_430px]">
|
||||
<div class="mb-[22px] flex items-center gap-[13px]">
|
||||
<img
|
||||
src="/assets/arboretum-mark.png"
|
||||
alt=""
|
||||
width="46"
|
||||
height="46"
|
||||
class="block h-[46px] w-[46px] object-contain"
|
||||
/>
|
||||
<span
|
||||
class="inline-flex items-center gap-2 rounded-full border border-emerald-500/30 bg-emerald-500/[0.07] px-[11px] py-[5px] font-mono text-[11.5px] uppercase tracking-[0.1em] text-emerald-400"
|
||||
>
|
||||
<span class="h-1.5 w-1.5 rounded-full bg-emerald-400 shadow-[0_0_8px_#34d399]"></span>
|
||||
{{ t('heroBadge') }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<h1 class="m-0 text-[clamp(40px,5.6vw,64px)] font-bold leading-[1.04] tracking-[-0.035em] text-zinc-50">
|
||||
{{ t('heroTitle') }}
|
||||
</h1>
|
||||
<p class="mt-[22px] max-w-[520px] text-[clamp(17px,1.7vw,20px)] leading-[1.55] text-zinc-400">
|
||||
{{ t('heroSub') }}
|
||||
</p>
|
||||
|
||||
<div
|
||||
class="mt-[30px] flex max-w-[480px] items-stretch overflow-hidden rounded-[10px] border border-zinc-800 bg-zinc-950/60"
|
||||
>
|
||||
<div
|
||||
class="flex min-w-0 flex-1 items-center gap-2.5 overflow-x-auto whitespace-nowrap px-[15px] font-mono text-sm"
|
||||
>
|
||||
<span class="text-emerald-400">$</span><span class="text-zinc-200">{{ INSTALL_COMMAND }}</span>
|
||||
</div>
|
||||
<CopyButton variant="bar" :text="INSTALL_COMMAND" :label="t('copyCommand')" />
|
||||
</div>
|
||||
|
||||
<div class="mt-6 flex flex-wrap gap-[13px]">
|
||||
<a
|
||||
href="#how"
|
||||
class="inline-flex items-center gap-[9px] rounded-[9px] bg-emerald-600 px-6 py-[13px] text-[15.5px] font-semibold text-white no-underline transition-[background,transform] duration-150 ease-in-out hover:-translate-y-px hover:bg-emerald-500 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-500/70"
|
||||
>
|
||||
{{ t('getStarted') }}
|
||||
<svg width="17" height="17" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14" /><path d="m12 5 7 7-7 7" /></svg>
|
||||
</a>
|
||||
<a
|
||||
:href="REPO"
|
||||
target="_blank"
|
||||
rel="noopener"
|
||||
class="inline-flex items-center gap-[9px] rounded-[9px] border border-zinc-800 px-[22px] py-[13px] text-[15.5px] font-medium text-zinc-100 no-underline transition-colors hover:border-emerald-500/45 hover:text-emerald-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-emerald-500/70"
|
||||
>
|
||||
<IconGitea :size="17" />
|
||||
{{ t('gitea') }}
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<HeroMockup />
|
||||
</section>
|
||||
</template>
|
||||