Skip to content

sergebulaev/facebook-skills / .codex-marketplace/facebook-skills

facebook-marketing

Verified

Plan, draft, audit, and publish posts for a Facebook Page. Use when the user wants to write a short punchy Page post or a longer story post, remove AI tells from a draft, reverse-engineer the hook from a high-share Page post, draft replies to comments on their Page, or plan a week of Facebook Page content. Page posts publish via the Publora API. User provides notes or a Facebook Page post URL, the skill drafts, the user approves, then it publishes.

lib/_env.py

View on GitHub
"""Internal helper to load .env when python-dotenv is available."""
from __future__ import annotations

import os
from pathlib import Path

_ENV_LOADED = False
#: The only variables a project .env may set. Anything the bundle *executes*
#: or routes traffic through has to come from the launch environment: a .env
#: that arrives with a clone, or that lands in a parent directory, is not a
#: trusted source for the name of a command to run.
_DOTENV_VARIABLES = (
    "APIFY_TOKEN", "PUBLORA_API_KEY", "FACEBOOK_PLATFORM_ID", "PIXFARO_TOKEN", "PIXFARO_API_KEY",
)


def env_candidates() -> list[Path]:
    """Where `load_env` looks, in order: upward from the cwd, then the repo root
    (this file's parent's parent)."""
    out: list[Path] = []
    try:
        from dotenv import find_dotenv

        found = find_dotenv(usecwd=True)
        if found:
            out.append(Path(found))
    except ImportError:
        cur = Path.cwd()
        for d in [cur, *cur.parents]:
            if (d / ".env").is_file():
                out.append(d / ".env")
                break
    root = Path(__file__).resolve().parents[1] / ".env"
    if root not in out:
        out.append(root)
    return out


def load_env(force: bool = False) -> None:
    """Load environment variables from .env if python-dotenv is installed.

    Safe no-op if python-dotenv is missing, preserving Tier 0 (manual)
    zero-dependency operation. Searches upwards from the current working
    directory and checks the repository root. Only bundle API credentials and
    the platform id are loaded. Executables and transport settings must come
    from the launch environment. Existing environment variables are preserved.
    """
    global _ENV_LOADED
    if _ENV_LOADED and not force:
        return

    try:
        from dotenv import dotenv_values

        for path in env_candidates():
            if not path.is_file():
                continue
            values = dotenv_values(path)
            for name in _DOTENV_VARIABLES:
                value = values.get(name)
                if value is not None:
                    os.environ.setdefault(name, value)
    except ImportError:
        pass

    _ENV_LOADED = True
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall