Skip to content

Commit ffa04f2

Browse files
jeremymanningclaude
andcommitted
Use add_borders.py for real SVG hand-drawn photo borders
- ImageService now calls the website repo's add_borders.py via subprocess instead of drawing simple wobble rectangles. Fails if not configured. - Added WEBSITE_REPO_PATH env var to config (documented in .env.example) - Added find_existing_photo() to check images/people/ for pre-placed photos - Added is_photo_bordered() to detect already-processed photos - Passed website_repo_path to ImageService in onboard handler Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e57048d commit ffa04f2

4 files changed

Lines changed: 133 additions & 262 deletions

File tree

cdl_bot/.env.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ GOOGLE_CALENDAR_CONTEXTUAL_DYNAMICS_LAB=primary@group.calendar.google.com
4747
GOOGLE_CALENDAR_OUT_OF_LAB=outoflab@group.calendar.google.com
4848
GOOGLE_CALENDAR_CDL_RESOURCES=resources@group.calendar.google.com
4949

50+
# =============================================================================
51+
# OPTIONAL: Website Repo Path (for photo borders)
52+
# =============================================================================
53+
54+
# Path to the contextlab.github.io repo checkout on this machine.
55+
# Required for processing member photos with the real SVG hand-drawn borders.
56+
# The repo must contain scripts/add_borders.py and images/templates/*.svg
57+
WEBSITE_REPO_PATH=/path/to/contextlab.github.io
58+
5059
# =============================================================================
5160
# OPTIONAL: Anthropic Configuration (for bio editing)
5261
# =============================================================================

cdl_bot/config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,9 @@ class Config:
146146
border_color: tuple = (0, 105, 62) # Dartmouth green RGB
147147
border_width: int = 8
148148

149+
# Path to the website repo (contextlab.github.io) for add_borders.py and templates
150+
website_repo_path: Optional[Path] = None
151+
149152
# Local storage for processed files
150153
output_dir: Path = Path(__file__).parent / "output"
151154

@@ -167,11 +170,16 @@ def from_env(cls) -> "Config":
167170
except ValueError:
168171
anthropic = None
169172

173+
# Optional: website repo path for add_borders.py
174+
website_repo_path = os.environ.get("WEBSITE_REPO_PATH")
175+
website_path = Path(website_repo_path) if website_repo_path else None
176+
170177
config = cls(
171178
slack=slack,
172179
github=github,
173180
google_calendar=google_calendar,
174181
anthropic=anthropic,
182+
website_repo_path=website_path,
175183
)
176184

177185
# Ensure output directory exists

cdl_bot/handlers/onboard.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ def register_onboard_handlers(app: App, config: Config):
3434
"""Register all onboarding-related handlers with the Slack app."""
3535

3636
github_service = GitHubService(config.github.token, config.github.org_name)
37-
image_service = ImageService(config.border_color, config.border_width)
37+
image_service = ImageService(
38+
config.border_color, config.border_width,
39+
website_repo_path=config.website_repo_path,
40+
)
3841
bio_service = None
3942
if config.anthropic:
4043
bio_service = BioService(config.anthropic.api_key, config.anthropic.model)

0 commit comments

Comments
 (0)