Files
gcontext/api
bernatsamperaandClaude Opus 4.6 9af1dcfe69 release: api-v0.3.0
Anonymous install telemetry: POST /api/telemetry accepts install events
from the CLI, GET /api/admin/installs lists them (auth-protected).
Install model and installs table auto-created on startup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-08-11 11:23:52 +02:00
..
2026-08-11 11:23:52 +02:00
2026-08-11 11:23:52 +02:00
2026-08-11 11:23:52 +02:00

workflows API

The marketplace backend for workflow templates. A FastAPI service with a Postgres database. Templates are stored as file bundles (one row per file) plus indexed manifest fields parsed server-side from the bundle's index.md frontmatter (see docs/workflows.md for the template standard).

Publishing is submit-for-review: anyone can POST a bundle, it lands pending, and it appears publicly only after approval.

Endpoints

  • GET /api/workflows: approved directory (id, name, description, tags).
  • GET /api/workflows/{id}: one approved template with its full file bundle.
  • POST /api/workflows: submit a bundle for review. Body: {"files": [{"path": "...", "content": "..."}]}.
  • GET /api/moderation/workflows: pending entries (admin token).
  • GET /api/moderation/workflows/{id}: one pending bundle (admin token).
  • POST /api/moderation/workflows/{id}/approve: publish (admin token). Approving an id that is already published replaces the published content.
  • POST /api/moderation/workflows/{id}/reject: hide (admin token).

Moderation auth is a single bearer token: Authorization: Bearer $ADMIN_TOKEN.

Configuration

Env vars: DATABASE_URL (postgresql+psycopg://...), ADMIN_TOKEN. Optional: MAX_FILE_BYTES (default 1000000), MAX_BUNDLE_BYTES (default 5000000), MAX_FILES (default 200).

Tables are created on startup.

Run locally

cd api
uv sync
DATABASE_URL=postgresql+psycopg://... ADMIN_TOKEN=dev uv run uvicorn app.main:app --reload

Tests

Tests need Docker (they start a throwaway Postgres container):

cd api
uv run pytest

Seed

ADMIN_TOKEN=... uv run python scripts/seed.py <template-folder> --api-url https://api.gcontext.ai