Files
snippets/cline-build-dependencies-ubuntu22.md

187 lines
4.3 KiB
Markdown
Raw Permalink Normal View History

# Cline Build-Dependencies für Ubuntu 22.04 (Airgapped)
> Zusätzlich benötigte Software zum Bauen der CLI-Applikation und der VS Code Extension (VSIX) aus dem Projekt [cline/cline](https://github.com/cline/cline).
## Überblick
Das Cline-Projekt ist ein Monorepo mit zwei Haupt-Build-Targets:
- **CLI** (`apps/cli`) — gebaut mit Bun
- **VS Code Extension / VSIX** (`apps/vscode`) — gebaut mit npm/esbuild
Beide Targets teilen sich ein SDK (`sdk/packages/*`), das zuerst gebaut werden muss.
---
## 1. Runtimes & Package Manager
| Software | Version | Zweck | Quelle |
|----------|---------|-------|--------|
| **Node.js** | ≥ 22 | Runtime, npm für VS Code Extension | [nodejs.org](https://nodejs.org/) (Binary-Tarball) |
| **Bun** | 1.3.13 (exakt) | Monorepo Package Manager, CLI-Bundler | [bun.sh](https://bun.sh/) (Single Binary) |
| **Git** | ≥ 2.x | Versionskontrolle | `apt install git` |
| **Git LFS** | ≥ 3.x | Large File Storage (Repo benötigt LFS) | `apt install git-lfs` |
> **Ubuntu 22.04 Hinweis:** Die Standardrepos liefern nur Node 12. Node 22 muss als Binary-Tarball oder über NodeSource offline bereitgestellt werden.
---
## 2. Build-Tools (System-Pakete)
Für native Node-Addons (insbesondere `better-sqlite3`, `grpc-tools`):
```bash
sudo apt install -y build-essential python3
```
| Paket | Inhalt |
|-------|--------|
| `build-essential` | gcc, g++, make |
| `python3` | Für node-gyp (Native Addon Build) |
---
## 3. Zum Bauen der CLI (`apps/cli`)
Die CLI wird ausschließlich mit Bun gebaut:
```bash
# 1. SDK bauen
bun run build:sdk
# 2. CLI bauen
bun -F @cline/cli build
# oder vom Root:
bun run build
```
**Benötigte Tools:** Bun 1.3.13, Node ≥ 22
---
## 4. Zum Bauen der VSIX (`apps/vscode`)
Die VS Code Extension nutzt npm und esbuild:
```bash
cd apps/vscode
# 1. Dependencies installieren (inkl. Webview)
npm run install:all
# 2. Protocol Buffer Dateien generieren (vor erstem Build erforderlich!)
npm run protos
# 3. Extension paketieren → erzeugt .vsix
npm run package
```
### Zusätzlich benötigte npm-Tools (kommen als devDependencies)
| Tool | Zweck |
|------|-------|
| `esbuild` | Bundler für die Extension |
| `@vscode/vsce` | Erzeugt die `.vsix`-Datei |
| `@biomejs/biome` | Linter/Formatter |
| `@bufbuild/protobuf` / protobuf-Toolchain | Protocol Buffer Code-Generierung |
| `typescript` ≥ 5.9 | TypeScript-Compiler |
### Webview-UI
Die Extension enthält ein separates React-Frontend (`webview-ui/`), gebaut mit:
- Vite
- Tailwind CSS
- React
Diese werden durch `npm run install:all` mitinstalliert und durch `npm run package` automatisch gebaut.
---
## 5. System-Libraries für Tests (optional)
Für E2E- und Integrationstests auf einem headless Linux-System:
```bash
sudo apt install -y \
dbus \
libasound2 \
libatk-bridge2.0-0 \
libatk1.0-0 \
libdrm2 \
libgbm1 \
libgtk-3-0 \
libnss3 \
libx11-xcb1 \
libxcomposite1 \
libxdamage1 \
libxfixes3 \
libxkbfile1 \
libxrandr2 \
xvfb
```
Diese Bibliotheken werden für die VS Code Test-Umgebung und Playwright E2E-Tests benötigt.
---
## 6. Airgapped-Strategie
### Vorbereitung (auf Maschine mit Internet)
```bash
# Repository klonen
git lfs install
git clone https://github.com/cline/cline.git
cd cline
# Bun-Dependencies (SDK + CLI)
bun install
# npm-Dependencies (VS Code Extension)
cd apps/vscode
npm run install:all
cd ../..
# SDK vorab bauen
bun run build:sdk
# Protobuf-Dateien generieren
cd apps/vscode && npm run protos && cd ../..
```
### Transfer ins Airgapped-Netz
```bash
# Gesamtes Projekt inkl. node_modules als Tarball
tar czf cline-offline.tar.gz cline/
```
> **Wichtig:** Die nativen Binaries (`better-sqlite3`, `grpc-tools`, etc.) sind plattformspezifisch. Die Vorbereitung muss auf einer identischen Ubuntu 22.04 x86_64 Maschine erfolgen.
### Build im Airgapped-Netz
```bash
tar xzf cline-offline.tar.gz
cd cline
# CLI bauen
bun run build
# VSIX paketieren
cd apps/vscode
npm run package
# → Erzeugt claude-dev-<version>.vsix
```
---
## Zusammenfassung
| Komponente | Benötigte Software |
|------------|-------------------|
| **Beide** | Node.js ≥ 22, Git, Git LFS |
| **CLI** | Bun 1.3.13 |
| **VSIX** | npm (via Node.js), build-essential, python3 |
| **Tests** | GUI-Libraries (siehe Abschnitt 5), xvfb |
| **Offline** | Vorbereiteter Tarball mit allen Dependencies |