Skip to main content

Automated documentation asset generation for software projects

Project description

Phantom

Automated documentation screenshots for software projects.

PyPI Python 3.12+ License: MIT


The Problem

Documentation screenshots go stale. Every UI change means manually re-capturing images, cropping them, adding drop shadows, updating the README, and committing. Most teams give up and let their docs rot.

The Solution

Phantom automates the entire pipeline: launch your app, execute actions, capture screenshots, process them, and commit the results — all from a single YAML manifest.

# .phantom.yml
phantom: "1"
project: "my-app"
name: "My App"

setup:
  type: web
  build:
    - npm ci
  run:
    command: "npm run dev"
    ready_check:
      type: http
      url: "http://localhost:3000"

captures:
  - id: dashboard
    name: "Dashboard"
    route: "/"
    output: "docs/screenshots/dashboard.png"
    actions:
      - type: wait_for
        selector: ".dashboard-loaded"
      - type: set_theme
        theme: dark
phantom run -p ./my-app

Installation

pipx install phantom-docs
# or
pip install phantom-docs

For web runner captures, install Playwright browsers:

playwright install chromium

Check your setup:

phantom doctor

Quick Start

# 1. Initialize a manifest (auto-detects project type)
phantom init

# 2. Edit .phantom.yml with your routes and captures

# 3. Run the pipeline
phantom run -p .

Onboard Your Project

The fastest way to set up Phantom for an existing project is with Claude Code. Copy the onboarding prompt into Claude Code while in your project's root directory — it will analyze your codebase and generate everything Phantom needs:

  • Demo mode with realistic fixture data
  • .phantom.yml manifest with 5-8 captures
  • GitHub Actions workflow for automated updates
  • README sentinels for screenshot placement
# From your project directory:
cat path/to/phantom/docs/onboarding-prompt.md | pbcopy  # macOS
# Then paste into Claude Code

Runners

Phantom supports multiple runner types for different kinds of applications:

Runner Type Use Case Key Tools
Web web Browser-based apps Playwright, Node
TUI tui Terminal applications pyte, silicon
Docker Compose docker-compose Containerized apps Docker

Runners are pluggable — see Writing Runner Plugins for the extension API.

Manifest Reference

The .phantom.yml manifest has these top-level sections:

phantom: "1"              # Schema version
project: "my-app"         # Unique project ID (kebab-case)
name: "My App"            # Display name

setup:                     # How to build and run the project
  type: web                # Runner type
  build: [...]             # Build commands
  run:                     # Run configuration
    command: "..."
    ready_check: { ... }

capture_defaults:          # Defaults applied to all captures
  viewport: { width: 1280, height: 800 }
  theme: dark

captures:                  # Screenshot definitions
  - id: hero
    name: "Hero screenshot"
    route: "/"
    output: "docs/hero.png"
    actions: [...]

processing:                # Image processing pipeline
  format: png
  border:
    style: drop-shadow

publishing:                # Git commit settings
  branch: main
  strategy: direct         # or "pr"
  readme_update: true

See docs/manifest-reference.md for the complete field reference.

CLI Reference

Command Description
phantom run -p <path> Run the capture pipeline
phantom validate <manifest> Validate a manifest file
phantom init Scaffold a new .phantom.yml
phantom doctor Check system dependencies
phantom status Show run history
phantom serve Start webhook listener + scheduler
phantom gc Clean up stale workspaces

Common Options

Option Description
--dry-run Run pipeline without git commits
--capture <id> Run a single capture
--group <name> Run a named group of captures
--skip-publish Capture and process, skip git
--force Commit even if below diff threshold
--if-changed Skip if repo HEAD unchanged
--verbose / -v Enable debug logging

How It Works

 .phantom.yml
      │
      ▼
 ┌──────────┐     ┌──────────┐     ┌──────────┐     ┌──────────┐
 │ Validate  │────▶│  Build   │────▶│  Launch  │────▶│ Capture  │
 │ Manifest  │     │ Project  │     │   App    │     │ Screenshots│
 └──────────┘     └──────────┘     └──────────┘     └──────────┘
                                                          │
      ┌───────────────────────────────────────────────────┘
      ▼
 ┌──────────┐     ┌──────────┐     ┌──────────┐
 │ Darkroom │────▶│  README  │────▶│   Git    │
 │ Process  │     │  Update  │     │ Publish  │
 └──────────┘     └──────────┘     └──────────┘
  1. Validate — Parse and validate the manifest with Pydantic
  2. Build — Run build commands (npm ci, cargo build, etc.)
  3. Launch — Start the app and wait for ready check
  4. Capture — Execute actions and take screenshots
  5. Darkroom — Process images (crop, borders, optimize, diff)
  6. README — Update sentinel regions with new image tags
  7. Publish — Commit and push (or open a PR)

Configuration

Environment Variables

Variable Description
PHANTOM_WEBHOOK_SECRET HMAC secret for webhook verification
PHANTOM_MANIFEST_MAP Repo-to-manifest mapping for serve mode

README Sentinels

Add markers to your README for automatic image updates:

<!-- phantom:hero -->
<!-- /phantom:hero -->

Phantom will inject the <img> tag between these markers when a capture with readme_target: hero changes.

Contributing

See CONTRIBUTING.md for development setup, running tests, and contribution guidelines.

License

MIT — Copyright 2026 Will Buscombe

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phantom_docs-0.2.0.tar.gz (205.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phantom_docs-0.2.0-py3-none-any.whl (98.4 kB view details)

Uploaded Python 3

File details

Details for the file phantom_docs-0.2.0.tar.gz.

File metadata

  • Download URL: phantom_docs-0.2.0.tar.gz
  • Upload date:
  • Size: 205.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for phantom_docs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 10ad7eb6920650ac379194343c8d1b4550650d5f7445d84253baaa8e1d341ca4
MD5 e1f0281f32becfb41babd24bb3016b35
BLAKE2b-256 71f5ff519ee8769d066166fe7a8ceceb946420e9cf8ef4997d8c55498efa43ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for phantom_docs-0.2.0.tar.gz:

Publisher: release.yml on wbuscombe/phantom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file phantom_docs-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: phantom_docs-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 98.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for phantom_docs-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3ac0124bff22568a0b81a61e05deb19ec3c1eed832e5b63ba4d397557940635
MD5 391a4f4c9235da3d277eaa228ce034de
BLAKE2b-256 2d04b716ddfd5df932c15d40be286867b12fe3d5a400b29bf3f74bd33ecddb99

See more details on using hashes here.

Provenance

The following attestation bundles were made for phantom_docs-0.2.0-py3-none-any.whl:

Publisher: release.yml on wbuscombe/phantom

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page