API Reference
Use this reference to explore the Python modules that make up the scaffolder. Narrative explanations live in Architecture; this section links to the code-level API for each component.
Entry Points
octopus_widget_scaffolder
Command-line driver that normalises arguments, parses JSON payloads, and invokes
scaffolder.generator.scaffold_widget. Handles both inline GraphQL operations
and external files through mutually exclusive CLI flags.
octopus_widget_scaffolder.py - CLI entry point for the widget scaffolder.
app
FastAPI application powering the browser UI. Streams progress updates over chunked HTTP responses so the frontend can update the activity log in real time. Includes endpoints for health checks, widget generation, and zip downloads.
FastAPI front-end for the Octopus widget scaffolder.
Generators
scaffolder.generator
Coordinates name transformations, GraphQL preparation, template rendering, and archive creation. Extensible via dependency injection for custom template folders.
scaffolder/generator.py - now only supports ‘widget’ kind 2025-06-22 (fixed header/variable injection per-operation)
scaffolder.widget_generator
Owns the React component rendering logic. Builds TypeScript that imports only the required Octopus SDK hooks, wires up mutations, and exposes typed configuration props.
scaffolder/widget_generator.py - Generates the default <Widget>.tsx file
scaffolder.utils
Shared helpers for naming, GraphQL manipulation, JSON schema generation, and filesystem writes. Used by both CLI and UI flows.
scaffolder/utils.py - Utility functions for scaffolder/generator.py
Tests and Fixtures
The unit tests live under tests/ and double as usage examples. Refer to
tests/test_templates.py for assertions that guard template coverage and
placeholder substitution. Updating templates usually requires extending these
fixtures.