Files
claude-workflow/bootstrap.sh
T
martinandClaude Opus 4.7 6aecff2eea feat: Markdown-Hook mit Custom-Rule "no-hr"
Erzwingt Struktur über Überschriften statt horizontaler Trennlinien.

- Custom Rule hooks/markdownlint-rules/no-hr.js erkennt --- / *** / ___
  über das markdown-it-Token "hr" und liefert fixInfo zum Entfernen.
- .markdownlint-cli2.jsonc aktiviert no-hr und deaktiviert MD013/MD040/MD041/MD060
  (Begründung jeweils inline kommentiert).
- hooks/auto-format.sh erweitert um md|markdown-Zweig mit zwei --fix-Pässen
  (zweiter Pass räumt MD012-Doppel-Leerzeilen auf, die nach HR-Entfernung entstehen).
- bootstrap.sh installiert markdownlint-cli2 idempotent via npm -g.

Verifiziert:
- Custom Rule meldet --- und *** als Verstoß.
- Zwei --fix-Pässe entfernen Trennlinien und überflüssige Leerzeilen, Endzustand 0 Fehler.
- Bestehende README in /home/martin/Darktable/README.md ist nach Konfig-Anpassung 0 Fehler.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 10:10:17 +02:00

144 lines
4.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -euo pipefail
REPO="/mnt/projekte/claude-workflow"
echo "=== Claude-Workflow Bootstrap ==="
# Skills (als Verzeichnis-Symlinks: ~/.claude/skills/<name> → repo/skills/<name>/)
mkdir -p ~/.claude/skills
for d in "$REPO/skills/"/*/; do
name=$(basename "$d")
ln -sfn "$d" ~/.claude/skills/"$name"
done
echo "✓ Skills verlinkt"
# Agents
mkdir -p ~/.claude/agents
for f in "$REPO/agents/"*.md; do
ln -sf "$f" ~/.claude/agents/
done
echo "✓ Agents verlinkt"
# Dotfiles
ln -sf "$REPO/dotfiles/CLAUDE.md" ~/.claude/CLAUDE.md
ln -sf "$REPO/dotfiles/settings.json" ~/.claude/settings.json
ln -sf "$REPO/dotfiles/statusline-command.sh" ~/.claude/statusline-command.sh
ln -sf "$REPO/dotfiles/gitea-mcp-wrapper.sh" ~/.claude/gitea-mcp-wrapper.sh
chmod +x "$REPO/dotfiles/gitea-mcp-wrapper.sh"
echo "✓ Dotfiles verlinkt"
# Hooks ausführbar machen
chmod +x "$REPO/hooks/"*.sh
echo "✓ Hooks ausführbar"
echo ""
echo "=== Voraussetzungen prüfen ==="
# --- gh (GitHub CLI, wird auch für Gitea-PRs genutzt) ---
if command -v gh &>/dev/null; then
echo "✓ gh $(gh --version | head -1)"
else
echo " gh fehlt installiere via apt..."
sudo apt-get install -y gh
echo "✓ gh installiert"
fi
# --- jq ---
if command -v jq &>/dev/null; then
echo "✓ jq $(jq --version)"
else
echo " jq fehlt installiere via apt..."
sudo apt-get install -y jq
echo "✓ jq installiert"
fi
# --- ruff ---
if command -v ruff &>/dev/null; then
echo "✓ ruff $(ruff --version)"
else
echo " ruff fehlt installiere via pipx..."
if ! command -v pipx &>/dev/null; then
sudo apt-get install -y pipx
pipx ensurepath
fi
pipx install ruff
echo "✓ ruff installiert"
fi
# --- shellcheck (Bash-Lint-Hook + /script) ---
if command -v shellcheck &>/dev/null; then
echo "✓ shellcheck $(shellcheck --version | awk '/^version:/ {print $2}')"
else
echo " shellcheck fehlt installiere via apt..."
sudo apt-get install -y shellcheck
echo "✓ shellcheck installiert"
fi
# --- markdownlint-cli2 (Markdown-Lint-Hook, custom rule no-hr) ---
if command -v markdownlint-cli2 &>/dev/null; then
echo "✓ markdownlint-cli2 $(markdownlint-cli2 --version 2>/dev/null | head -1)"
else
echo " markdownlint-cli2 fehlt installiere via npm..."
if ! command -v npm &>/dev/null; then
sudo apt-get install -y npm
fi
sudo npm install -g markdownlint-cli2
echo "✓ markdownlint-cli2 installiert"
fi
# --- gitea-mcp Binary ---
if [[ -x ~/go/bin/gitea-mcp ]]; then
echo "✓ gitea-mcp vorhanden"
else
echo " gitea-mcp fehlt installiere via go install..."
go install gitea.com/gitea/gitea-mcp@latest
echo "✓ gitea-mcp installiert"
fi
# --- context7 Plugin-Check ---
if claude mcp list 2>/dev/null | grep -q "context7"; then
echo "✓ context7 Plugin aktiv"
else
echo "⚠ context7 Plugin nicht aktiv prüfe enabledPlugins in settings.json"
echo " Ggf. Claude Code neu starten oder Plugin manuell aktivieren."
fi
# --- gitea-mcp in Claude Code registrieren ---
if claude mcp list 2>/dev/null | grep -q "^gitea:"; then
echo "✓ gitea MCP bereits registriert"
else
echo " Registriere gitea MCP..."
claude mcp add --scope user gitea -- bash ~/.claude/gitea-mcp-wrapper.sh
echo "✓ gitea MCP registriert"
fi
# --- secret-tool + Gitea-Token ---
if ! command -v secret-tool &>/dev/null; then
echo " secret-tool fehlt installiere libsecret-tools..."
sudo apt-get install -y libsecret-tools
echo "✓ secret-tool installiert"
else
echo "✓ secret-tool vorhanden"
fi
echo " Gitea-Token prüfen..."
if secret-tool lookup user claude-code token gitea &>/dev/null; then
echo "✓ Gitea-Token vorhanden"
else
echo ""
echo " Gitea-Token für claude-code nicht gefunden."
read -r -p " Gitea-Token eingeben (https://gitea.troeger-net.org): " GITEA_TOKEN
if [[ -n "${GITEA_TOKEN// /}" ]]; then
echo -n "$GITEA_TOKEN" | secret-tool store \
--label="Gitea claude-code token" \
user claude-code token gitea
echo "✓ Gitea-Token gespeichert"
else
echo "⚠ Kein Token eingegeben übersprungen"
fi
fi
echo ""
echo "✓ Bootstrap abgeschlossen"