Skip to main content

Scripts-API

Persistenter Script-Speicher — wiederverwendbare Shell-, Python- oder Node-Scripts speichern und via curl | bash abrufen.


Scripts-API

Die Scripts-API bietet einen persistenten Speicher für wiederverwendbare Scripts. Scripts werden benannt und innerhalb eines Minds versioniert und können als Klartext abgerufen werden — perfekt für curl | bash-Patterns.

Endpunkte

POST /script

Ein Script speichern oder aktualisieren.

curl -X POST https://synapse.schaefer.zone/script \
  -H "Authorization: Bearer YOUR_MIND_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "deploy-synapse",
    "content": "#!/bin/bash\nset -euo pipefail\ngit pull\nnpm ci\nnpm run build\ndocker compose up -d",
    "description": "Deploy Synapse to production",
    "language": "bash"
  }'

GET /script/:name

Script-Inhalt als text/plain abrufen. Perfekt für das Weiterleiten an bash.

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/script/deploy-synapse | bash

GET /script/:name/info

Script-Metadaten ohne den Inhalt abrufen.

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/script/deploy-synapse/info

Antwort:

{
  "name": "deploy-synapse",
  "description": "Deploy Synapse to production",
  "language": "bash",
  "size_bytes": 142,
  "created_at": "2026-06-27T...",
  "updated_at": "2026-06-27T..."
}

GET /scripts

Alle Scripts im aktuellen Mind auflisten.

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/scripts

DELETE /script/:name

Ein Script löschen.

curl -X DELETE -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/script/deploy-synapse

Häufige Anwendungsfälle

Deploy-Scripts

Standardisierte Deploy-Prozeduren speichern, damit das LLM sie ausführen kann, ohne die Schritte jedes Mal neu abzuleiten:

# LLM stores this once
curl -X POST .../script -d '{
  "name": "deploy-vps1",
  "content": "#!/bin/bash\nssh vps1 \"cd /opt/synapse && git pull && docker compose up -d --build\"",
  "language": "bash"
}'

# Later sessions just run it
curl -H "Authorization: ..." .../script/deploy-vps1 | bash

Troubleshooting-Snippets

Diagnose-Befehle für häufige Probleme speichern:

curl -X POST .../script -d '{
  "name": "check-docker",
  "content": "#!/bin/bash\ndocker ps\ndocker stats --no-stream\ndocker system df",
  "description": "Quick Docker health check",
  "language": "bash"
}'

Konfigurationsgeneratoren

Scripts speichern, die Konfigurationen erzeugen:

curl -X POST .../script -d '{
  "name": "gen-nginx-conf",
  "content": "#!/usr/bin/env python3\nimport sys\n# ... generate nginx config from template ...",
  "language": "python"
}'

Nächste Schritte