Skip to main content

Explain code like a story — with analogies, characters, and narrative

Project description

🎬 Code Storyteller

Explain code like a story — with analogies, characters, and narrative.

Install

pip install -e .

Setup

export ANTHROPIC_API_KEY=sk-...
# or for OpenRouter:
export OPENROUTER_API_KEY=sk-or-...
export MODEL=open_router/nvidia/nemotron-3-super-120b-a12b:free

Usage

# Tell a story about a file
storytell tell auth.py --as heist
storytell tell sort.py --as recipe
storytell tell api.js --as 5yo
storytell tell handler.ts --as pm

# Specific function/class only
storytell tell auth.py --as heist --block validate_token

# Diff — narrate changes between two file versions
storytell diff old.py new.py --as heist

# Explore blocks in a file
storytell explore auth.py

# ASCII structure map
storytell map auth.py

# List styles
storytell styles

# View history (with star ratings)
storytell history

# Rate a past story (1-5)
storytell rate 42 5

# Save an analogy
storytell learn recursion "a story that tells itself"

# View saved analogies
storytell memory

Styles

Style Description
heist Code as a bank heist movie
recipe Code as a cooking recipe
5yo Explain like you're 5 years old
pm Explain like a product manager
sports Code as live sports commentary

Options

  • --no-stream — disable streaming output
  • --block <name> — target specific function/class
  • --as <style> — pick story style (default: heist)

Supported Languages

  • Python (.py)
  • JavaScript (.js, .jsx)
  • TypeScript (.ts, .tsx)

Tests

python3 -m pytest tests/ -v
# 25 tests passing

Usage (continued)

# Export story as styled PDF/PNG/HTML card
storytell card auth.py --as heist --format pdf
storytell card auth.py --as recipe --format html

# Multi-file project stories
storytell tell ./src/ --as heist
storytell tell ./src/ --as pm --focus main.py

# Launch web dashboard
storytell serve --port 8100

Install optional dependencies:

pip install code-storyteller[export]   # PDF/PNG card export
pip install code-storyteller[web]      # Web dashboard

VS Code Extension

See vscode/. Install CLI first, then:

cd vscode && npm install && npm run compile
# Press F5 in VS Code to launch Extension Development Host

GitHub Action

See action.yml and .github/workflows/storyteller-example.yml.

Roadmap

  • CLI with 5 story styles
  • Code parser (Python, JS, TS) with tree-sitter
  • SQLite memory + history
  • Diff stories (narrate code changes)
  • Rate stories + analogy memory
  • ASCII code map
  • Story card image export
  • VS Code extension
  • GitHub Action
  • Web dashboard
  • Multi-file / project stories

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

code_storyteller-0.1.0.tar.gz (43.5 kB view details)

Uploaded Source

Built Distribution

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

code_storyteller-0.1.0-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

Details for the file code_storyteller-0.1.0.tar.gz.

File metadata

  • Download URL: code_storyteller-0.1.0.tar.gz
  • Upload date:
  • Size: 43.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for code_storyteller-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1940275608797d09b3974513dd28b9e836ff099abada2ed1df21a1dded15b737
MD5 20a64f7a4d6dd8360f5c5106ab55acb2
BLAKE2b-256 e7f61ed0d4013acaef3c021cb0c8fbbd5e5b0f8880b531f3857f8362cf7c53c5

See more details on using hashes here.

File details

Details for the file code_storyteller-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for code_storyteller-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6a1e8ddd95cff1f27b892836049c8ebe327dfd35e9118407f8ae658cea2fc8ef
MD5 2ad3d2145d8c523bd0e4b0fe0064e53d
BLAKE2b-256 2a99bcf6008c2881b2c498bbe82a226fa1bd5a61c0ffe54e475b84727ced70c6

See more details on using hashes here.

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