Phase 14, part 1: plans, each team's account, and their limits

The multi-tenant edition's plans (Free and Paid as decided, or a plans
file) and each team's billing account, with a 14-day trial of Paid. A
team's plan caps what its people and agents may change: modules outside it
stay readable, a lapsed team changes nothing, and agents, Market entries,
crawls and background jobs keep to it. Without a Stripe key, no billing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 13:15:00 -07:00
co-authored by Claude Opus 5.5
parent e47764a78e
commit a47990f9bf
19 changed files with 848 additions and 7 deletions
+8
View File
@@ -38,6 +38,7 @@ import (
"supermarket/internal/ai"
"supermarket/internal/appmail"
"supermarket/internal/backup"
"supermarket/internal/billing"
"supermarket/internal/config"
"supermarket/internal/content"
"supermarket/internal/core"
@@ -343,6 +344,13 @@ func run(log *slog.Logger) error {
}
defer teams.Close()
srv.Teams, srv.Platform = teams, database
if cfg.StripeKey != "" {
plans, err := billing.Load(cfg.PlansFile, cfg.StripePrice, cfg.StripePriceYear, cfg.StripePriceStorage)
if err != nil {
return err
}
srv.Plans = plans
}
if alone {
srv.RecoverTeams(context.Background())
}