Organization Manager Documentation

Quick Start

# Install
pip install -e .

# Full organization scan
org-manager scan --org Digital-AI-Finance

# Run tests
pytest tests/

CLI Reference


# Install (development mode)
pip install -e .

# Full organization scan (generates JSON, HTML, Markdown reports)
org-manager scan --org Digital-AI-Finance

# Individual analysis commands
org-manager health --org Digital-AI-Finance
org-manager quality --org Digital-AI-Finance
org-manager publish --org Digital-AI-Finance
org-manager patterns --org Digital-AI-Finance

# Auto-fix issues (LICENSE, README)
org-manager fix --org Digital-AI-Finance --dry-run
org-manager fix --org Digital-AI-Finance

# Site detection and landing page
org-manager sites --org Digital-AI-Finance
org-manager landing-page --org Digital-AI-Finance --push

# Analytics (Cloudflare Workers)
org-manager analytics scan --org Digital-AI-Finance
org-manager analytics deploy --org Digital-AI-Finance --dry-run

# Run tests
pytest tests/

# Run single test
pytest tests/test_file.py::test_function -v

# Install with dev dependencies
pip install -e ".[dev]"

Architecture

### Core Components - **cli.py**: Unified CLI entry point using argparse subcommands - **github_client.py**: REST API client with rate limiting, pagination, and caching. Auth order: `--token` > `gh auth token` > `GITHUB_TOKEN` env - **cache.py**: JSON-based local caching - **report_generator.py**: Multi-format output (console, JSON, HTML with Chart.js, Markdown) ### Analyzers (org_manager/analyzers/) Each analyzer returns `(Metrics dataclass, list[CheckResult])`: - **health_analyzer.py**: Activity (commits), community (stars/forks), maintenance (issues/PRs) - **quality_analyzer.py**: Tests, CI/CD, linting tools - **publish_analyzer.py**: README completeness, CITATION.cff, DOI, QuantLet metadata - **pattern_analyzer.py**: Cross-repo patterns (shared deps, license consistency) ### Tools (org_manager/tools/) - **org_fixer.py**: Auto-fix LICENSE/README via GitHub API - **site_detector.py**: Detect Jekyll, Hugo, MkDocs, Sphinx - **landing_page_generator.py**: Generate org landing page HTML - **cf_analytics.py**: Cloudflare Workers for page view tracking ### Data Flow 1. `GitHubClient` fetches repo data via REST API 2. Analyzers process repos and return metrics + check results 3. `RepoReport` aggregates all analyzer outputs per repo 4. `OrgReport` aggregates all repos + pattern analysis 5. `report_generator` exports to multiple formats

API Reference

Core

M github_client.py Core

GitHub REST API client with authentication, rate limiting, and pagination.

C class RateLimitInfo

GitHub API rate limit status.

reset_datetime()

Get reset time as datetime.

seconds_until_reset()

Seconds until rate limit resets.

C class Repository

Repository metadata.

from_api(cls, data: dict)

Create Repository from GitHub API response.

C class GitHubClient

GitHub REST API client with authentication and rate limiting.

__init__(org: str, token: Optional[str], timeout: int, public_only: bool)

Initialize GitHub client. Args: org: GitHub organization name token: GitHub personal access token (auto-detected if not provided) timeout: Request timeout in seconds public_only: Only fetch public repositories

rate_limit()

Current rate limit info.

get_org_repos()

List all repositories in organization.

get_repo(repo_name: str)

Get detailed repository info.

get_repo_contributors(repo_name: str)

Get repository contributors.

get_repo_issues(repo_name: str, state: str, since: Optional[datetime])

Get repository issues.

get_repo_pulls(repo_name: str, state: str)

Get repository pull requests.

get_repo_releases(repo_name: str)

Get repository releases.

get_repo_commits(repo_name: str, since: Optional[datetime], max_pages: int)

Get repository commits.

get_repo_contents(repo_name: str, path: str)

List repository contents at path.

get_file_content(repo_name: str, path: str)

Get raw file content (base64 decoded).

get_repo_languages(repo_name: str)

Get repository language breakdown (bytes per language).

file_exists(repo_name: str, path: str)

Check if a file exists in the repository.

search_code(repo_name: str, query: str)

Search for code in a repository.

create_or_update_file(repo_name: str, path: str, content: str, message: str, branch: Optional[str])

Create or update a file in the repository.

M cache.py Core

JSON-based result caching for GitHub API responses.

C class CacheEncoder (json.JSONEncoder)

JSON encoder that handles dataclasses and datetime objects.

default(obj: Any) No documentation

C class ResultCache

JSON-based cache for API results.

__init__(cache_dir: Optional[Path], ttl_hours: int)

Initialize cache. Args: cache_dir: Directory to store cache files (default: ~/.cache/org_manager) ttl_hours: Cache TTL in hours (default: 24)

get(key: str)

Get cached result if not expired. Args: key: Cache key (e.g., "org/repo/issues") Returns: Cached data or None if not found/expired

set(key: str, data: Any)

Store result in cache. Args: key: Cache key data: Data to cache (must be JSON-serializable)

delete(key: str)

Delete a cache entry. Args: key: Cache key Returns: True if deleted, False if not found

clear()

Clear all cached data.

clear_expired()

Clear expired cache entries. Returns: Number of entries cleared

stats()

Get cache statistics. Returns: Dict with cache stats (entries, size, expired)

M report_generator.py Core

Report generator - Console, JSON, HTML, and Markdown output formats.

C class RepoReport

Complete report for a single repository.

health_score()

Calculate health score (0-100).

quality_score()

Calculate quality score (0-100).

publish_score()

Calculate publish score (0-100).

overall_score()

Calculate overall score (0-100).

passed()

Check if repo passes threshold (70%).

C class OrgReport

Complete organization analysis report.

overall_health_score()

Average health score across all repos.

overall_quality_score()

Average quality score across all repos.

overall_publish_score()

Average publish score across all repos.

overall_score()

Overall organization score.

passed()

Check if org passes threshold.

C class ReportEncoder (json.JSONEncoder)

JSON encoder for dataclasses and datetime objects.

default(obj: Any) No documentation
print_console_report(report: OrgReport)

Print formatted report to console.

export_json(report: OrgReport, output_dir: str)

Export report to timestamped JSON file. Returns: Path to exported file

export_html(report: OrgReport, output_dir: str)

Export to HTML dashboard with Chart.js. Returns: Path to exported file

export_markdown(report: OrgReport, output_dir: str)

Export to Markdown report. Returns: Path to exported file

generate_default_markdown(report: OrgReport)

Generate default markdown report.

get_default_html_template()

Return default HTML template with enhanced dashboard.

M cli.py Core

Organization Manager CLI - Unified entry point for all commands. Commands: scan Full organization scan (all metrics) health Repository health metrics only quality Code quality analysis only patterns Cross-repo pattern analysis publish Publication readiness check dashboard Generate HTML dashboard from previous scan fix Auto-fix LICENSE and README issues sites Detect site frameworks (Jekyll, Hugo, etc.) landing-page Generate organization landing page analytics Cloudflare analytics subcommands: scan List repos with GitHub Pages deploy Deploy tracking workers inject Inject tracking into HTML files snippet Generate tracking snippet Usage: org-manager scan --org Digital-AI-Finance org-manager fix --org Digital-AI-Finance --dry-run org-manager landing-page --org Digital-AI-Finance --push

cmd_scan(args)

Full organization scan.

cmd_health(args)

Health metrics only.

cmd_quality(args)

Quality metrics only.

cmd_publish(args)

Publication readiness only.

cmd_patterns(args)

Cross-repo pattern analysis.

cmd_fix(args)

Auto-fix common issues.

main()

Main entry point.

Analyzers

M health_analyzer.py Analyzers

Repository health analyzer - activity, community, and maintenance metrics.

C class HealthMetrics

Repository health metrics.

C class HealthCheckResult

Single health check result.

status()

Get status string.

C class HealthAnalyzer

Analyze repository health metrics.

__init__(client: GitHubClient, stale_days: int)

Initialize health analyzer. Args: client: GitHub API client stale_days: Number of days to consider issues stale

analyze(repo: Repository)

Run all health checks on a repository. Returns: Tuple of (metrics, list of check results)

M quality_analyzer.py Analyzers

Code quality analyzer - tests, linting, CI/CD, and documentation checks.

C class QualityMetrics

Code quality metrics.

C class QualityCheckResult

Single quality check result.

status()

Get status string.

C class QualityAnalyzer

Analyze code quality indicators.

__init__(client: GitHubClient)

Initialize quality analyzer.

analyze(repo: Repository)

Run all quality checks on a repository. Returns: Tuple of (metrics, list of check results)

M publish_analyzer.py Analyzers

Publication readiness analyzer - README, reproducibility, and academic metadata checks.

C class PublishMetrics

Publication readiness metrics.

C class PublishCheckResult

Single publication check result.

status()

Get status string.

C class PublishAnalyzer

Analyze publication readiness.

__init__(client: GitHubClient)

Initialize publish analyzer.

analyze(repo: Repository)

Run all publication checks on a repository. Returns: Tuple of (metrics, list of check results)

M pattern_analyzer.py Analyzers

Cross-repository pattern analyzer - shared dependencies, file patterns, consistency.

C class DependencyInfo

Shared dependency information.

usage_count()

Number of repos using this dependency.

C class PatternMetrics

Cross-repo pattern metrics.

consistency_score()

Calculate overall consistency score across repos.

C class PatternAnalyzer

Analyze cross-repository patterns.

__init__(client: GitHubClient)

Initialize pattern analyzer.

analyze(repos: list[Repository])

Analyze patterns across all repositories. Args: repos: List of repositories to analyze Returns: PatternMetrics with cross-repo analysis

get_consistency_report(metrics: PatternMetrics, total_repos: int)

Generate a consistency report summary.

Tools

M org_fixer.py Tools

Organization fixer - automatically fix common issues in GitHub repos. Fixes: - Missing LICENSE files (adds MIT) - Incomplete READMEs (adds Description, Installation, Usage sections)

C class FixResult

Result of fixing a repository.

__post_init__() No documentation

C class OrgFixer

Fix common issues across organization repositories.

__init__(client: GitHubClient, dry_run: bool)

Initialize fixer. Args: client: GitHub API client dry_run: If True, only report what would be done

fix_all(repos: list[Repository])

Fix all issues in repositories. Args: repos: List of repositories to fix Returns: List of FixResult for each repo

fix_repo(repo: Repository)

Fix issues in a single repository.

main()

Main entry point.

M site_detector.py Tools

Site type detector - identify if repos use HTML, Jekyll, Hugo, etc.

C class SiteInfo

Site type information.

__post_init__() No documentation

C class SiteDetector

Detect site type for repositories.

__init__(client: GitHubClient) No documentation
detect(repo_name: str)

Detect site type for a repository.

cmd_detect(args)

Detect site types for all repos.

main()

Main entry point.

M landing_page_generator.py Tools

Landing Page Generator - Auto-generate organization landing page. Generates a responsive HTML page with all repos, site types, and search functionality. Features: Category grouping, dark mode, sorting, enhanced visuals.

C class LandingPageGenerator

Generate organization landing page.

__init__(client: GitHubClient, detector: SiteDetector) No documentation
generate(repos: list[Repository])

Generate landing page HTML.

cmd_generate(args)

Generate landing page.

main()

Main entry point.

M cf_analytics.py Tools

Cloudflare Analytics Deployer - Deploy tracking workers to GitHub Pages repos. Tracks page views and PDF downloads, stores data in GitHub Issues.

C class CloudflareClient

Cloudflare Workers API client.

__init__(account_id: str, api_token: str) No documentation
get_subdomain()

Get workers subdomain for account.

deploy_worker(script_name: str, script_content: str)

Deploy a worker script.

enable_worker_route(script_name: str)

Enable workers.dev route for script.

list_workers()

List all deployed workers.

load_config()

Load configuration from user-config.json.

get_worker_template()

Load worker template.

check_github_pages(client: GitHubClient, repo_name: str)

Check if repo has GitHub Pages enabled, return URL if so.

get_tracking_snippet(worker_url: str)

Generate tracking snippet HTML.

cmd_scan(args)

Scan repos for GitHub Pages.

cmd_deploy(args)

Deploy analytics workers to repos.

cmd_snippet(args)

Generate tracking snippet for a repo.

cmd_inject(args)

Inject tracking snippet into all HTML files.

main()

Main entry point.

Utility Scripts

M add_claude_gitignore.py Script

Add .claude/ and CLAUDE.md to .gitignore for all repos in an organization. Usage: python scripts/add_claude_gitignore.py --org Digital-AI-Finance --dry-run python scripts/add_claude_gitignore.py --org Digital-AI-Finance

get_github_token()

Get GitHub token from gh CLI or environment.

get_repos(org: str, token: str)

Fetch all repos in organization.

get_gitignore(org: str, repo: str, token: str)

Get current .gitignore content and SHA.

is_gitignore_entry(lines: list[str], pattern: str)

Check if pattern is an actual gitignore entry (not in a comment).

needs_update(content: str | None)

Check if .gitignore needs Claude entries.

create_updated_content(existing: str | None)

Create updated .gitignore content.

update_gitignore(org: str, repo: str, token: str, content: str, sha: str | None, dry_run: bool)

Update or create .gitignore via GitHub API.

main() No documentation

M catalog_charts.py Script

Catalog Charts Utility for LaTeX/Beamer Files Scans local directories for .tex files and catalogs all charts/figures, outputting to JSON organized by repo. Usage: python catalog_charts.py --dir "D:/Joerg/Research/slides" --recursive python catalog_charts.py --dir . --output my_charts.json

find_tex_files(directory: Path, recursive: bool)

Find all .tex files in directory.

get_line_number(content: str, position: int)

Get line number for a position in content.

is_beamer_file(content: str)

Check if file is a Beamer presentation.

extract_width(options: Optional[str])

Extract width from includegraphics options.

extract_figures_from_environments(content: str, file_path: str)

Extract figures from \begin{figure}...\end{figure} environments.

extract_standalone_includegraphics(content: str, file_path: str, figure_positions: set)

Extract standalone \includegraphics not in figure environments.

extract_all_figures(content: str, file_path: str)

Extract all figures (both in environments and standalone).

detect_repo_name(file_path: Path, root_dir: Path)

Detect repository name from file path.

catalog_charts(root_dir: Path, recursive: bool)

Catalog all charts in .tex files.

main() No documentation

M check_beamer_compliance.py Script

Beamer Template Compliance Checker Checks if a Beamer .tex file complies with the template_beamer_final standard. Outputs violations as JSON. Template requirements (from template_beamer_final.tex): - Document class: 8pt, aspectratio=169, beamer - Theme: Madrid - Color palette: mlpurple, mllavender, mlblue, mlorange, mlgreen, mlred, mlgray - Additional colors: lightgray, midgray - Navigation symbols: disabled - Itemize: circle, Enumerate: default - Margins: 5mm left/right - bottomnote command defined - Required packages: graphicx, booktabs, adjustbox, multicol, amsmath - Chart sizing: max 0.95\textwidth (full-size layouts use 0.95) - Max bullets per slide: 4 Usage: python check_beamer_compliance.py --file slides.tex python check_beamer_compliance.py --file slides.tex --output report.json

C class Violation

A single compliance violation.

C class ComplianceReport

Full compliance report.

get_line_number(content: str, position: int)

Get line number for a position in content.

check_document_class(content: str)

Check document class settings.

check_theme(content: str)

Check theme settings.

check_colors(content: str)

Check color definitions.

check_navigation_symbols(content: str)

Check that navigation symbols are disabled.

check_footline(content: str)

Check footline template - template_beamer_final uses Madrid default.

check_margins(content: str)

Check margin settings.

check_packages(content: str)

Check required packages.

check_bottomnote_command(content: str)

Check bottomnote command definition.

check_chart_sizing(content: str)

Check chart/figure sizing.

check_bullet_count(content: str)

Check bullet count per frame.

check_branding(content: str)

Check for QuantLet branding elements.

check_beamer_colors(content: str)

Check beamer color settings.

check_compliance(file_path: Path)

Run all compliance checks on a file.

main() No documentation

M generate_docs.py Script

Documentation Generator for Organization Manager Generates a single HTML documentation page from Python docstrings and CLAUDE.md. Uses AST parsing to extract module, class, and function documentation. Usage: python scripts/generate_docs.py python scripts/generate_docs.py --output docs/index.html

C class FunctionDoc

Documentation for a function.

C class ClassDoc

Documentation for a class.

C class ModuleDoc

Documentation for a module.

extract_function_args(node: ast.FunctionDef)

Extract function argument names and annotations.

extract_module_docs(file_path: Path)

Extract documentation from a Python module.

parse_claude_md(file_path: Path)

Parse CLAUDE.md into sections.

escape_html(text: str)

Escape HTML special characters.

format_docstring(docstring: Optional[str])

Format docstring as HTML.

format_code_block(code: str, language: str)

Format code as a code block.

generate_module_html(module: ModuleDoc, category: str)

Generate HTML for a module.

generate_html(modules: dict[str, list[ModuleDoc]], claude_sections: dict, scripts: list[ModuleDoc])

Generate the full HTML documentation page.

main() No documentation

M remove_claude_files.py Script

Remove .claude/ and CLAUDE.md files from repos in an organization. Deletes tracked files via GitHub API. Skips GitHub Actions workflows. Usage: python scripts/remove_claude_files.py --org Digital-AI-Finance --dry-run python scripts/remove_claude_files.py --org Digital-AI-Finance

get_github_token()

Get GitHub token from gh CLI or environment.

get_repos(org: str, token: str)

Fetch all repos in organization.

get_repo_tree(org: str, repo: str, token: str)

Get all files in a repo using Git Trees API.

should_delete(path: str)

Check if a file should be deleted based on path.

get_file_sha(org: str, repo: str, path: str, token: str)

Get SHA of a file for deletion.

delete_file(org: str, repo: str, path: str, token: str, dry_run: bool)

Delete a file via GitHub API.

find_claude_files(org: str, repo: str, token: str)

Find all claude-related files in a repo.

main() No documentation

M search_claude_references.py Script

Search all repos in an organization for 'claude' references. Searches both file names and file contents. Usage: python scripts/search_claude_references.py --org Digital-AI-Finance

get_github_token()

Get GitHub token from gh CLI or environment.

get_repos(org: str, token: str)

Fetch all repos in organization.

search_code_in_repo(org: str, repo: str, query: str, token: str)

Search for code in a specific repo using GitHub Search API.

get_repo_tree(org: str, repo: str, token: str)

Get all file paths in a repo using Git Trees API.

search_repo(org: str, repo: str, token: str)

Search a single repo for claude references.

main() No documentation

Course Creator Skills

A comprehensive skill system for Claude Code that automates the creation of complete academic course websites. From a YAML manifest to a deployed GitHub Pages site in 7 automated stages.

Organization Repositories

Live view of all repositories in the Digital-AI-Finance organization. Updates automatically when repos change.

-
Total Repos
-
Public
-
Private
Loading repositories...