Files
gcontext/api
bernatsamperaandClaude Opus 4.6 5fa3f6bffd Add gcontext share command and submission status endpoint
CLI command validates a local template folder against the workflow standard
(frontmatter, steps/, runs/example/), bundles files, and POSTs to the
marketplace API. --status mode queries GET /api/workflows/{id}/status.
16 new tests (suite 68 -> 84).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-08-09 18:16:12 +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