{
  "project": "AdminPanel",
  "branchName": "ralph/user-invite-flow",
  "description": "User Invite Flow - Allow admins to invite new users via email",
  "userStories": [
    {
      "id": "US-001",
      "title": "Add invitations table to database",
      "description": "As a developer, I need to store pending invitations in the database.",
      "acceptanceCriteria": [
        "Create invitations table with columns: id, email, role, invited_by, token, expires_at, accepted_at, created_at",
        "Add unique index on token column",
        "Add index on email column",
        "Generate and run migration successfully",
        "Typecheck passes"
      ],
      "priority": 1,
      "passes": true,
      "notes": "Migration 0047 created and applied."
    },
    {
      "id": "US-002",
      "title": "Create invitation server actions",
      "description": "As a developer, I need server actions to create and validate invitations.",
      "acceptanceCriteria": [
        "createInvitation action accepts email and role, generates secure token, sets 72h expiry",
        "validateInvitation action looks up token and checks expiry",
        "acceptInvitation action marks invitation as accepted and creates user account",
        "Duplicate email within 24h returns error instead of creating new invitation",
        "Typecheck passes",
        "Tests pass"
      ],
      "priority": 2,
      "passes": true,
      "notes": "All three actions implemented and tested."
    },
    {
      "id": "US-003",
      "title": "Build invite user form in admin panel",
      "description": "As an admin, I want to invite a new user by entering their email and selecting a role.",
      "acceptanceCriteria": [
        "Form with email input and role dropdown (admin, editor, viewer)",
        "Submit calls createInvitation server action",
        "Success toast shows 'Invitation sent to {email}'",
        "Validation error shown for invalid email format",
        "Typecheck passes",
        "Verify in browser using dev-browser skill"
      ],
      "priority": 3,
      "passes": true,
      "notes": "Form working, toast notifications confirmed."
    },
    {
      "id": "US-004",
      "title": "Add pending invitations list to admin users page",
      "description": "As an admin, I want to see all pending invitations alongside existing users.",
      "acceptanceCriteria": [
        "Pending invitations section shows below user list",
        "Each row shows email, role, invited by, sent date, and expiry status",
        "Expired invitations shown with 'Expired' badge",
        "Resend button available for expired invitations",
        "Typecheck passes",
        "Verify in browser using dev-browser skill"
      ],
      "priority": 4,
      "passes": false,
      "notes": ""
    }
  ]
}
