feat(community): add COMMUNITY_DB_URL config + community tier gates (publish/fork_adapt)

This commit is contained in:
pyr0ball 2026-04-12 17:55:52 -07:00
parent 59a3bb8382
commit 22f0bfff9c
2 changed files with 17 additions and 0 deletions

View file

@ -53,6 +53,17 @@ class Settings:
# Feature flags
ENABLE_OCR: bool = os.environ.get("ENABLE_OCR", "false").lower() in ("1", "true", "yes")
# Community feature
# COMMUNITY_DB_URL: unset = community writes disabled (local/offline mode, fail soft)
COMMUNITY_DB_URL: str | None = os.environ.get("COMMUNITY_DB_URL") or None
COMMUNITY_PSEUDONYM_SALT: str = os.environ.get(
"COMMUNITY_PSEUDONYM_SALT", "kiwi-default-salt-change-in-prod"
)
COMMUNITY_CLOUD_FEED_URL: str = os.environ.get(
"COMMUNITY_CLOUD_FEED_URL",
"https://menagerie.circuitforge.tech/kiwi/api/v1/community/posts",
)
# Runtime
DEBUG: bool = os.environ.get("DEBUG", "false").lower() in ("1", "true", "yes")
CLOUD_MODE: bool = os.environ.get("CLOUD_MODE", "false").lower() in ("1", "true", "yes")

View file

@ -18,6 +18,7 @@ KIWI_BYOK_UNLOCKABLE: frozenset[str] = frozenset({
"style_classifier",
"meal_plan_llm",
"meal_plan_llm_timing",
"community_fork_adapt", # Fork a community plan with LLM pantry adaptation
})
# Feature → minimum tier required
@ -44,6 +45,11 @@ KIWI_FEATURES: dict[str, str] = {
"recipe_collections": "paid",
"style_classifier": "paid", # LLM auto-tag for saved recipe style tags; BYOK-unlockable
# Community (free to browse, paid to publish/fork)
"community_browse": "free", # Read-only feed access
"community_publish": "paid", # Publish plans/outcomes to community feed
"community_fork_adapt": "paid", # Fork a plan with LLM pantry adaptation; BYOK-unlockable
# Premium tier
"multi_household": "premium",
"background_monitoring": "premium",