Initial commit of Descrybe v2 without local scratch artifacts.

Drop one-shot tmp/axe scripts and agent i18n scratch so the Gitea tree is deployable.
This commit is contained in:
2026-08-09 22:47:43 +02:00
commit 8580c996c3
1285 changed files with 325780 additions and 0 deletions
+87
View File
@@ -0,0 +1,87 @@
// Seed isolated "new user" personas for guided-assistant QA.
//
// cd apps/api
// go run ./cmd/seed-guide-personas -postgres "$env:DATABASE_URL"
//
// Password defaults to DemoPass123! (same as docs/demo-user.md).
package main
import (
"context"
"errors"
"flag"
"fmt"
"log"
"os"
"strings"
"time"
"github.com/descrybe/descrybe-v2/apps/api/internal/auth"
"github.com/descrybe/descrybe-v2/apps/api/internal/billing"
"github.com/jackc/pgx/v5/pgxpool"
)
type persona struct {
Email string
Name string
CompanyName string
}
var personas = []persona{
{"guide-feed-url@descrybe.local", "Guide Feed URL", "Guide · Feed URL"},
{"guide-upload-csv@descrybe.local", "Guide Upload CSV", "Guide · Upload CSV"},
{"guide-shopify@descrybe.local", "Guide Shopify", "Guide · Shopify"},
{"guide-woocommerce@descrybe.local", "Guide WooCommerce", "Guide · WooCommerce"},
{"guide-mapping@descrybe.local", "Guide Mapping", "Guide · Mapping"},
{"guide-process@descrybe.local", "Guide Process", "Guide · Process"},
{"guide-api@descrybe.local", "Guide API Keys", "Guide · API Keys"},
{"guide-support@descrybe.local", "Guide Support", "Guide · Support"},
{"guide-attributes@descrybe.local", "Guide Attributes", "Guide · Attributes"},
}
func main() {
postgresURL := flag.String("postgres", os.Getenv("DATABASE_URL"), "Postgres URL")
password := flag.String("password", "DemoPass123!", "Password for all guide personas")
flag.Parse()
if strings.TrimSpace(*postgresURL) == "" {
log.Fatal("-postgres / DATABASE_URL is required")
}
if strings.TrimSpace(*password) == "" {
log.Fatal("-password is required")
}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
defer cancel()
pg, err := pgxpool.New(ctx, *postgresURL)
if err != nil {
log.Fatalf("postgres: %v", err)
}
defer pg.Close()
authSvc := &auth.Service{Pool: pg}
billingSvc := &billing.Service{Pool: pg}
fmt.Println("Seeding guide assistant personas…")
for _, p := range personas {
email := strings.ToLower(strings.TrimSpace(p.Email))
res, err := authSvc.Register(ctx, auth.RegisterInput{
Email: email,
Password: *password,
Name: p.Name,
CompanyName: p.CompanyName,
})
if err != nil {
if errors.Is(err, auth.ErrUserExists) {
fmt.Printf(" exists %s (company unchanged)\n", email)
continue
}
log.Fatalf("%s: %v", email, err)
}
if err := billingSvc.ProvisionFreePlan(ctx, res.CompanyID); err != nil {
log.Fatalf("provision plan for %s: %v", email, err)
}
fmt.Printf(" created %s → company %s (%s)\n", email, p.CompanyName, res.CompanyID)
}
fmt.Println("Done. Login at /login with DemoPass123! (or -password).")
}