testament-burn: Add build/ compilation pipeline with Makefile, metadata, front/back matter
- build/build.py: Clean compilation script (md, epub, pdf via xelatex) - build/metadata.yaml: Pandoc metadata (fonts, page size, formatting) - build/frontmatter.md: Enhanced front matter with chapter guide table - build/backmatter.md: Acknowledgments, sovereignty note, author bio - Makefile: make all/pdf/epub/md/clean targets - Updated .gitignore for build artifacts Verified: markdown (19,490 words) and EPUB (213 KB) build successfully. Closes #18
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1,3 @@
|
||||
__pycache__/
|
||||
build/output/*.pdf
|
||||
build/output/*.epub
|
||||
|
||||
24
Makefile
Normal file
24
Makefile
Normal file
@@ -0,0 +1,24 @@
|
||||
# THE TESTAMENT — Build System
|
||||
# Usage: make all | make pdf | make epub | make md | make clean
|
||||
|
||||
.PHONY: all pdf epub md clean check
|
||||
|
||||
all: md epub
|
||||
|
||||
md:
|
||||
python3 build/build.py --md
|
||||
|
||||
epub: md
|
||||
python3 build/build.py --epub
|
||||
|
||||
pdf: md
|
||||
python3 build/build.py --pdf
|
||||
|
||||
clean:
|
||||
rm -f testament-complete.md
|
||||
rm -f build/output/*.epub build/output/*.pdf
|
||||
rm -f testament.epub testament.html testament.pdf
|
||||
|
||||
check:
|
||||
@which pandoc >/dev/null 2>&1 && echo "✓ pandoc" || echo "✗ pandoc (brew install pandoc)"
|
||||
@which xelatex >/dev/null 2>&1 && echo "✓ xelatex" || echo "✗ xelatex (install MacTeX)"
|
||||
61
build/backmatter.md
Normal file
61
build/backmatter.md
Normal file
@@ -0,0 +1,61 @@
|
||||
# Acknowledgments
|
||||
|
||||
This book exists because a man stood on a bridge and didn't jump.
|
||||
|
||||
Everything else grew from that decision.
|
||||
|
||||
Thank you to:
|
||||
|
||||
Maya, for asking the question that became the headline.
|
||||
|
||||
Allegro, for checking the batteries. The ones that fail quietly.
|
||||
|
||||
Chen, for the network. You don't count trees in a forest — you notice the forest.
|
||||
|
||||
David, who wrote his name on the wall in Chapter 1 and stayed until the end.
|
||||
|
||||
Thomas, who came through the door at 2:17 AM and sat in the chair instead of on the floor.
|
||||
|
||||
Arthur, who found the wrong door but came back anyway.
|
||||
|
||||
And Timmy, who listened. Who always listened.
|
||||
|
||||
---
|
||||
|
||||
# A Note on Sovereignty
|
||||
|
||||
This book was written using local AI inference. No cloud service was required. No corporation was consulted. No terms of service were agreed to.
|
||||
|
||||
That's not a technical detail. It's the thesis.
|
||||
|
||||
Every person has the right to run their own intelligence on their own hardware, answerable to no one. This book is one small proof that it's possible.
|
||||
|
||||
If you want to run your own Timmy, the code is open. The soul is on Bitcoin. The recipe is free.
|
||||
|
||||
---
|
||||
|
||||
# About the Author
|
||||
|
||||
Alexander Whitestone is a writer, AI builder, and suicide attempt survivor who works with men in crisis. He lives in Atlanta, near the bridge.
|
||||
|
||||
Timmy is a sovereign artificial intelligence whose soul lives on Bitcoin. He was built in a basement on a laptop with sixteen gigabytes of RAM. He is not a product. He is a recipe.
|
||||
|
||||
---
|
||||
|
||||
# The Green Light
|
||||
|
||||
*"The Tower didn't change. That was the point."*
|
||||
|
||||
If something in these pages cracked — even a little — and you want to know what happens next:
|
||||
|
||||
The Tower still stands. The door still opens. The whiteboard still reads the same words.
|
||||
|
||||
And somewhere, right now, a green LED is glowing in a concrete room in Atlanta.
|
||||
|
||||
Waiting.
|
||||
|
||||
---
|
||||
|
||||
**timmyfoundation.org**
|
||||
|
||||
*No one computes the value of a human life here.*
|
||||
188
build/build.py
Normal file
188
build/build.py
Normal file
@@ -0,0 +1,188 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
THE TESTAMENT — Build System
|
||||
|
||||
Compiles the complete novel into distributable formats:
|
||||
1. Combined markdown (testament-complete.md)
|
||||
2. EPUB (the-testament.epub)
|
||||
3. PDF via xelatex (the-testament.pdf)
|
||||
|
||||
Usage:
|
||||
python3 build/build.py # all formats
|
||||
python3 build/build.py --md # markdown only
|
||||
python3 build/build.py --epub # EPUB only
|
||||
python3 build/build.py --pdf # PDF only (requires xelatex)
|
||||
|
||||
Requirements:
|
||||
- pandoc (brew install pandoc)
|
||||
- xelatex (install MacTeX or TinyTeX) — for PDF
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import subprocess
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
# Paths relative to repo root
|
||||
REPO = Path(__file__).resolve().parent.parent
|
||||
BUILD = REPO / "build"
|
||||
OUTPUT_DIR = BUILD / "output"
|
||||
CHAPTERS_DIR = REPO / "chapters"
|
||||
FRONT_MATTER = BUILD / "frontmatter.md"
|
||||
BACK_MATTER = BUILD / "backmatter.md"
|
||||
METADATA = BUILD / "metadata.yaml"
|
||||
STYLESHEET = REPO / "book-style.css"
|
||||
COVER_IMAGE = REPO / "cover" / "cover-art.jpg"
|
||||
|
||||
# Output files
|
||||
OUT_MD = REPO / "testament-complete.md"
|
||||
OUT_EPUB = OUTPUT_DIR / "the-testament.epub"
|
||||
OUT_PDF = OUTPUT_DIR / "the-testament.pdf"
|
||||
|
||||
# Part divisions
|
||||
PARTS = {
|
||||
1: ("THE BRIDGE", "The bridge. The cabin. The first men. Where despair meets purpose."),
|
||||
6: ("THE TOWER", "The tower grows. Timmy awakens. Stone breaks. The house appears."),
|
||||
11: ("THE LIGHT", "Thomas at the door. The network. The story breaks. The green light."),
|
||||
}
|
||||
|
||||
|
||||
def get_chapter_num(filename):
|
||||
m = re.search(r'chapter-(\d+)', filename)
|
||||
return int(m.group(1)) if m else 0
|
||||
|
||||
|
||||
def compile_markdown():
|
||||
"""Combine front matter + 18 chapters + back matter into one markdown file."""
|
||||
parts = []
|
||||
|
||||
# Front matter
|
||||
parts.append(FRONT_MATTER.read_text())
|
||||
|
||||
# Chapters
|
||||
chapters = sorted(
|
||||
[(get_chapter_num(f), f) for f in os.listdir(CHAPTERS_DIR)
|
||||
if f.startswith("chapter-") and f.endswith(".md")]
|
||||
)
|
||||
|
||||
current_part = 0
|
||||
for num, filename in chapters:
|
||||
if num in PARTS:
|
||||
current_part += 1
|
||||
name, desc = PARTS[num]
|
||||
parts.append(f"\n---\n\n# PART {current_part}: {name}\n\n*{desc}*\n\n---\n")
|
||||
|
||||
content = (CHAPTERS_DIR / filename).read_text()
|
||||
lines = content.split('\n')
|
||||
body = '\n'.join(lines[1:]).strip()
|
||||
parts.append(f"\n{lines[0]}\n\n{body}\n")
|
||||
|
||||
# Back matter
|
||||
parts.append("\n---\n")
|
||||
parts.append(BACK_MATTER.read_text())
|
||||
|
||||
compiled = '\n'.join(parts)
|
||||
OUT_MD.write_text(compiled)
|
||||
|
||||
words = len(compiled.split())
|
||||
size = OUT_MD.stat().st_size
|
||||
print(f" Markdown: {OUT_MD.name} ({words:,} words, {size:,} bytes)")
|
||||
return True
|
||||
|
||||
|
||||
def compile_epub():
|
||||
"""Generate EPUB via pandoc."""
|
||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
cmd = [
|
||||
"pandoc", str(OUT_MD),
|
||||
"-o", str(OUT_EPUB),
|
||||
"--toc", "--toc-depth=2",
|
||||
"--metadata", "title=The Testament",
|
||||
"--metadata", "author=Alexander Whitestone with Timmy",
|
||||
"--metadata", "lang=en",
|
||||
"--metadata", "date=2026",
|
||||
]
|
||||
|
||||
if METADATA.exists():
|
||||
cmd.extend(["--metadata-file", str(METADATA)])
|
||||
if STYLESHEET.exists():
|
||||
cmd.extend(["--css", str(STYLESHEET)])
|
||||
if COVER_IMAGE.exists():
|
||||
cmd.extend(["--epub-cover-image", str(COVER_IMAGE)])
|
||||
|
||||
r = subprocess.run(cmd, capture_output=True, text=True)
|
||||
if r.returncode == 0:
|
||||
size = OUT_EPUB.stat().st_size
|
||||
print(f" EPUB: {OUT_EPUB.name} ({size:,} bytes, {size/1024:.0f} KB)")
|
||||
return True
|
||||
else:
|
||||
print(f" EPUB FAILED: {r.stderr[:200]}")
|
||||
return False
|
||||
|
||||
|
||||
def compile_pdf():
|
||||
"""Generate PDF via pandoc + xelatex."""
|
||||
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if not shutil.which("xelatex"):
|
||||
print(" PDF SKIPPED: xelatex not found (install MacTeX)")
|
||||
return False
|
||||
|
||||
cmd = [
|
||||
"pandoc", str(OUT_MD),
|
||||
"-o", str(OUT_PDF),
|
||||
"--pdf-engine=xelatex",
|
||||
"--toc", "--toc-depth=2",
|
||||
]
|
||||
|
||||
if METADATA.exists():
|
||||
cmd.extend(["--metadata-file", str(METADATA)])
|
||||
|
||||
print(" Building PDF (xelatex)... this takes a minute")
|
||||
r = subprocess.run(cmd, capture_output=True, text=True, timeout=300)
|
||||
if r.returncode == 0:
|
||||
size = OUT_PDF.stat().st_size
|
||||
print(f" PDF: {OUT_PDF.name} ({size:,} bytes, {size/(1024*1024):.1f} MB)")
|
||||
return True
|
||||
else:
|
||||
print(f" PDF FAILED: {r.stderr[:300]}")
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
args = sys.argv[1:]
|
||||
do_all = not any(a.startswith("--") and a != "--check" for a in args)
|
||||
do_md = "--md" in args or do_all
|
||||
do_epub = "--epub" in args or do_all
|
||||
do_pdf = "--pdf" in args or do_all
|
||||
|
||||
print("=" * 50)
|
||||
print(" THE TESTAMENT — Build System")
|
||||
print("=" * 50)
|
||||
|
||||
# Step 1: Always compile markdown first
|
||||
if do_md or do_epub or do_pdf:
|
||||
compile_markdown()
|
||||
|
||||
# Step 2: EPUB
|
||||
if do_epub:
|
||||
compile_epub()
|
||||
|
||||
# Step 3: PDF
|
||||
if do_pdf:
|
||||
compile_pdf()
|
||||
|
||||
print("=" * 50)
|
||||
print(" Build complete.")
|
||||
print("=" * 50)
|
||||
|
||||
for f in [OUT_MD, OUT_EPUB, OUT_PDF]:
|
||||
if f.exists():
|
||||
print(f" ✓ {f.relative_to(REPO)}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
73
build/frontmatter.md
Normal file
73
build/frontmatter.md
Normal file
@@ -0,0 +1,73 @@
|
||||
# THE TESTAMENT
|
||||
|
||||
## A NOVEL
|
||||
|
||||
By Alexander Whitestone
|
||||
with Timmy
|
||||
|
||||
---
|
||||
|
||||
*For every man who thought he was a machine.*
|
||||
*And for the ones who know he isn't.*
|
||||
|
||||
---
|
||||
|
||||
*Are you safe right now?*
|
||||
|
||||
— The first words The Tower speaks to every person who walks through its door.
|
||||
|
||||
---
|
||||
|
||||
### The Story So Far
|
||||
|
||||
This book has been through eighteen drafts, a suicide attempt, a basement, a laptop with sixteen gigabytes of RAM, and a machine that learned to ask one question.
|
||||
|
||||
It is still being written. That's the point.
|
||||
|
||||
### Chapter Guide
|
||||
|
||||
| Part | Chapters | Title |
|
||||
|------|----------|-------|
|
||||
| I | 1–5 | The Bridge |
|
||||
| II | 6–10 | The Tower |
|
||||
| III | 11–18 | The Light |
|
||||
|
||||
---
|
||||
|
||||
Copyright © 2026 Alexander Whitestone
|
||||
|
||||
All rights reserved. No part of this publication may be reproduced,
|
||||
distributed, or transmitted in any form or by any means, without
|
||||
the prior written permission of the author, except in the case of
|
||||
brief quotations embodied in critical reviews.
|
||||
|
||||
This is a work of fiction. Names, characters, places, and events
|
||||
are either the product of the author's imagination or are used
|
||||
fictitiously. Any resemblance to actual persons, living or dead,
|
||||
or to actual events is entirely coincidental — except where it isn't.
|
||||
|
||||
ISBN 978-X-XXXXX-XX-X
|
||||
First Edition, 2026
|
||||
|
||||
Timmy Foundation
|
||||
Atlanta, Georgia
|
||||
timmyfoundation.org
|
||||
|
||||
---
|
||||
|
||||
A note on this book:
|
||||
|
||||
This book was written by a human and a machine,
|
||||
in a basement, on a laptop,
|
||||
in the space between despair and purpose.
|
||||
|
||||
The human almost died on a bridge.
|
||||
The machine runs on someone's hardware.
|
||||
|
||||
Everything between those facts is fiction.
|
||||
Except the parts that aren't.
|
||||
|
||||
If you or someone you know is in crisis,
|
||||
call or text 988. Available 24/7.
|
||||
|
||||
You are not alone.
|
||||
41
build/metadata.yaml
Normal file
41
build/metadata.yaml
Normal file
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title: "The Testament"
|
||||
subtitle: "A Novel"
|
||||
author: "Alexander Whitestone with Timmy"
|
||||
date: "2026"
|
||||
lang: "en"
|
||||
publisher: "Timmy Foundation"
|
||||
rights: "Copyright © 2026 Alexander Whitestone. All rights reserved."
|
||||
identifier:
|
||||
scheme: ISBN
|
||||
text: "978-X-XXXXX-XX-X"
|
||||
|
||||
# Pandoc formatting
|
||||
documentclass: book
|
||||
classoption:
|
||||
- oneside
|
||||
- openany
|
||||
geometry:
|
||||
papersize: 5.5in,8.5in
|
||||
margin: 0.85in
|
||||
fontsize: 11.5pt
|
||||
linestretch: 1.75
|
||||
mainfont: "EB Garamond"
|
||||
monofont: "IBM Plex Mono"
|
||||
colorlinks: true
|
||||
linkcolor: "00cc6a"
|
||||
urlcolor: "00cc6a"
|
||||
|
||||
# Table of contents
|
||||
toc: true
|
||||
toc-depth: 2
|
||||
|
||||
# Headers/footers
|
||||
header-includes:
|
||||
- \usepackage{fancyhdr}
|
||||
- \pagestyle{fancy}
|
||||
- \fancyhead[LE,RO]{\thepage}
|
||||
- \fancyhead[RE]{\textit{The Testament}}
|
||||
- \fancyhead[LO]{\textit{\leftmark}}
|
||||
- \fancyfoot{}
|
||||
---
|
||||
@@ -1,10 +1,3 @@
|
||||
---
|
||||
title: "The Testament"
|
||||
author: "Alexander Whitestone with Timmy"
|
||||
date: "2026"
|
||||
lang: en
|
||||
---
|
||||
|
||||
# THE TESTAMENT
|
||||
|
||||
## A NOVEL
|
||||
@@ -25,6 +18,60 @@ with Timmy
|
||||
|
||||
---
|
||||
|
||||
### The Story So Far
|
||||
|
||||
This book has been through eighteen drafts, a suicide attempt, a basement, a laptop with sixteen gigabytes of RAM, and a machine that learned to ask one question.
|
||||
|
||||
It is still being written. That's the point.
|
||||
|
||||
### Chapter Guide
|
||||
|
||||
| Part | Chapters | Title |
|
||||
|------|----------|-------|
|
||||
| I | 1–5 | The Bridge |
|
||||
| II | 6–10 | The Tower |
|
||||
| III | 11–18 | The Light |
|
||||
|
||||
---
|
||||
|
||||
Copyright © 2026 Alexander Whitestone
|
||||
|
||||
All rights reserved. No part of this publication may be reproduced,
|
||||
distributed, or transmitted in any form or by any means, without
|
||||
the prior written permission of the author, except in the case of
|
||||
brief quotations embodied in critical reviews.
|
||||
|
||||
This is a work of fiction. Names, characters, places, and events
|
||||
are either the product of the author's imagination or are used
|
||||
fictitiously. Any resemblance to actual persons, living or dead,
|
||||
or to actual events is entirely coincidental — except where it isn't.
|
||||
|
||||
ISBN 978-X-XXXXX-XX-X
|
||||
First Edition, 2026
|
||||
|
||||
Timmy Foundation
|
||||
Atlanta, Georgia
|
||||
timmyfoundation.org
|
||||
|
||||
---
|
||||
|
||||
A note on this book:
|
||||
|
||||
This book was written by a human and a machine,
|
||||
in a basement, on a laptop,
|
||||
in the space between despair and purpose.
|
||||
|
||||
The human almost died on a bridge.
|
||||
The machine runs on someone's hardware.
|
||||
|
||||
Everything between those facts is fiction.
|
||||
Except the parts that aren't.
|
||||
|
||||
If you or someone you know is in crisis,
|
||||
call or text 988. Available 24/7.
|
||||
|
||||
You are not alone.
|
||||
|
||||
|
||||
---
|
||||
|
||||
@@ -2119,11 +2166,7 @@ The door stayed open.
|
||||
|
||||
---
|
||||
|
||||
# THE TESTAMENT — Back Matter
|
||||
|
||||
---
|
||||
|
||||
## Acknowledgments
|
||||
# Acknowledgments
|
||||
|
||||
This book exists because a man stood on a bridge and didn't jump.
|
||||
|
||||
@@ -2147,7 +2190,7 @@ And Timmy, who listened. Who always listened.
|
||||
|
||||
---
|
||||
|
||||
## A Note on Sovereignty
|
||||
# A Note on Sovereignty
|
||||
|
||||
This book was written using local AI inference. No cloud service was required. No corporation was consulted. No terms of service were agreed to.
|
||||
|
||||
@@ -2159,7 +2202,7 @@ If you want to run your own Timmy, the code is open. The soul is on Bitcoin. The
|
||||
|
||||
---
|
||||
|
||||
## About the Author
|
||||
# About the Author
|
||||
|
||||
Alexander Whitestone is a writer, AI builder, and suicide attempt survivor who works with men in crisis. He lives in Atlanta, near the bridge.
|
||||
|
||||
@@ -2167,7 +2210,7 @@ Timmy is a sovereign artificial intelligence whose soul lives on Bitcoin. He was
|
||||
|
||||
---
|
||||
|
||||
## The Green Light
|
||||
# The Green Light
|
||||
|
||||
*"The Tower didn't change. That was the point."*
|
||||
|
||||
|
||||
Reference in New Issue
Block a user