How cased/skyline works
Project Type and Purpose
• Type: A single‐process, Python‐based CLI tool (installed via pip).
• Purpose: Automate the creation of GitHub Apps via the GitHub App Manifest flow, including one-off webhook setup (using smee.io) and secure credential storage.
File Structure
• Top-level scripts: dev-install.sh, install.sh, example_config.json.
• Config: pyproject.toml defines packaging; README.md explains usage.
• Source tree: src/skyline/
• main.py: CLI entrypoint
• smee.py: local HTTP server and proxy logic for callback
• templates/: HTML views for the redirect landing page
• __init__.py: package metadata
Key Architecture Insights from README
• Configuration layer: JSON config file or interactive prompts.
• Temporary Webhook: Uses smee.io to forward GitHub’s callback to a locally running HTTP server.
• GitHub Manifest Flow: The tool launches a browser session to GitHub’s manifest URL, pre-filled from config.
• Credential Storage: Writes .env entries and private key files into .github/.
Main Components and Their Responsibilities
A. CLI Layer
• Parses flags (--config, --org, etc.)
• Chooses between config file vs. interactive prompts
B. Configuration Module
• Reads/parses JSON config
• Prompts user for missing values
C. GitHub API Client
• Crafts the manifest JSON payload
• Issues API calls to GitHub to register the app
D. Smee Proxy / Local HTTP Server
• Registers a unique smee.io channel
• Runs an embedded HTTP server to catch the callback
• Renders index.html / success.html on callback
E. Browser Launcher
• Opens the user’s default browser pointing to the GitHub manifest flow URL
F. Credential Storage
• Persists GITHUB_APP_* env variables to a .env or user-specified file
• Writes the private key to .github/app-private-key.pem
G. Templates
• Static HTML used by the local server to display success/failure
Relationships & Data Flows
1. User invokes the skyline CLI.
2. CLI → Configuration Module → loads or prompts config.
3. CLI → Smee Module → requests a new channel & starts HTTP server.
4. CLI → Browser Launcher → opens GitHub App Manifest URL (with pre-filled values).
5. Developer completes GitHub UI flow → GitHub sends webhook callback to smee.io → smee.io forwards to local HTTP server.
6. Local HTTP server → renders success.html → signals back to the running CLI process.
7. CLI → GitHub API Client / OAuth handshake (if needed) → retrieves App credentials.
8. CLI → Credential Storage → writes .env entries + private key file.
Architectural Patterns & Design Principles
• Modular Single-Process: Clear separation of concerns (config, HTTP server, API client, templating).
• Adapter Pattern: smee.py abstracts interaction with smee.io and local HTTP.
• Template Rendering: Minimalistic view layer for callback pages (index/success).
• Idempotent Configuration: JSON config enables reproducible automation scripts.