Case study · Backend / Python

WebWorks Generator (WWG)

Implemented · 9 production builds recorded, 5 operator-approved · 143 Python test files

Turns an existing web page into a reusable React/Next.js page, separating components, content, theme and local assets. It then verifies the result against the source one dimension at a time, so approval is attached to the exact generated artifact rather than assumed from a successful build.

01 · Source page
A services section of the theme demo page as the source renders it: three service items with line icons and a View all services link.
02 · Roles breakdown
The same section with WWG's breakdown drawn on it: a feature item block, three item blocks and a feature link, each labelled with its classifier score.
03 · Generated React components
The same services section rendered from WWG's generated React components, identical to the source.
Actual WebWorks Generator capture · review surface · theme demo page. The generated components render the section pixel for pixel: the source and generated captures are byte-identical.

Purpose

Turns an existing web page into a reusable React/Next.js page, separating components, content, theme and local assets.

The problem

A generated page can build successfully and still differ from its source. Approval has to attach to the exact generated artifact, not be assumed from a successful build.

What it contributes

Generation, in the WebWorks line: proven website designs become componentised products, verified against their source one dimension at a time.

Principal capabilities

  • Backend

    A Python 3.12 producer parses HTML and CSS, captures computed styles in a real browser, classifies sections, roles, plugins and blocks, emits component code, and extracts theme tokens, content and local assets. It also supports derivatives by replacing content, theme skin and licensed stock imagery.

  • Verification

    Before conversion, a source-passthrough gate proves the staged copy makes zero external network requests. Acceptance is defined by 17 dependency-ordered dimensions in a branched JSON contract shared by the Python writer and the TypeScript review console. Approval is bound to an artifact digest, so regeneration or a raised issue invalidates it.

  • Frontend

    A local Next.js review console renders the generated page layer by layer, so a defect can be traced to the stage that introduced it before a dimension is approved.

    Review console

Built with

  • Python
  • TypeScript
  • React
  • Next.js
Pythonwebworks-generator/app/console/review.py
def closure(requires: dict, start: str) -> set[str]:
    """`start` and everything it transitively requires.

    A SET REACHED BY WALKING, not a list built by following one predecessor. The pipeline
    branches — `roles` joins sections and plugins — so a chain-walk visited one arm and
    silently declared a page complete with the other arm unaccepted.
    """
    seen, stack = {start}, [start]
    while stack:
        for nxt in requires.get(stack.pop(), []):
            if nxt not in seen:
                seen.add(nxt)
                stack.append(nxt)
    return seen
Python · acceptance that walks the whole dependency graph. A page is complete only when every dimension it depends on is accepted, and each acceptance is bound to the artifact digest. Verbatim excerpt from the repository.

Implementation evidence

  • 9 production builds recorded, 5 operator-approved.
  • 143 Python test files.
  • Recorded fixes include an encoding default that corrupted inherited punctuation and a test runner that could appear green when suites exited during import.

Back to WebWorks website ecosystem

Visual evidence

01 · Source page
A services section of the theme demo page as the source renders it: three service items with line icons and a View all services link.
02 · Roles breakdown
The same section with WWG's breakdown drawn on it: a feature item block, three item blocks and a feature link, each labelled with its classifier score.
03 · Generated React components
The same services section rendered from WWG's generated React components, identical to the source.
Actual WebWorks Generator capture · review surface · theme demo page. The generated components render the section pixel for pixel: the source and generated captures are byte-identical.
WWG's pipeline review drawer for an accepted page: all 17 stages accepted, each with its status.
Pipeline review of an accepted page. All 17 stages are green. Each acceptance is bound to the digest of the artifact it approved, so regenerating a stage or raising an issue reopens it and everything that depends on it.Actual WebWorks Generator capture · review surface.
Read
01source
02flattened
03identified
04capture
Understand
05sections
06chrome
07targets
08plugins
09blocks
10roles
Generate
11components
12theme
13content
14assets
Prove
15runtime
16emitted
17composed

A dimension can be accepted only after the dimensions it depends on. The sequence branches: blocks needs sections, capture and plugins; components needs roles and capture. Approval is bound to the artifact digest.

Verified Architecture Diagram Dimensions and order from the generator's acceptance contract. Read, Understand, Generate and Prove are editorial groupings, not pipeline states.