Build, version-bump, sign and upload the AskMyDocs Desktop Tauri app (desktop/) to TestFlight / App Store Connect. Codifies the exact flow that shipped build 0.1.0 on 2026-06-23 — `tauri ios build --export-method app-store-connect`, automatic distribution signing, the transient export-error retry, and the Xcode Organizer GUI upload. Trigger when the user asks to "send/upload the app to TestFlight", "build the iOS app", "ship a new beta", bump the iOS version/build number, or distribute desktop/ to Apple.
After EVERY commit-push-PR cycle, the agent MUST loop on Copilot review + CI status until ALL Copilot comments resolved AND ALL CI checks green. NEVER stop after a single push. Trigger when opening a PR with `gh pr create`, after `gh pr push`, or when user asks to "fix PR" / "address review" / "make CI green". Applies to ALL repos lopadova/* and padosoft/*. The loop is mandatory for current and future sessions and for any developer working on this codebase.
How to wire an admin SPA page (or the chat) to the global TEAM (= tenant) switcher in the topbar — every authenticated route lives under /app/{teamHash}/…, the X-Tenant-Id header is automatic via the shared axios client, switching team rewrites the URL hash + clears the TanStack cache + remounts the route outlet, project options must come from tenant-scoped endpoints. Trigger when wiring an admin page to the team scope, when adding a NEW admin page / route / feature folder under frontend/src/features/, when adding a `navigate(...)` call, when touching a project picker / project filter, or when a page shows stale cross-team data after a team switch.
Every Eloquent query against tenant-aware tables MUST be scoped to the active tenant_id. Use `forTenant($tenantId)` scope (provided by BelongsToTenant trait) or explicit `where('tenant_id', $ctx->current())`. The TenantContext singleton holds the active tenant; never bypass it. Trigger when writing services / scopes / controllers that query tenant-aware models, when reviewing PRs that touch persistence, or when investigating R30 architecture test failures.
Author and maintain the AskMyDocs Mintlify documentation site under /docs-site/. Every page is a deep, academic, standalone explainer (motivation → theory → design+Mermaid diagram → data model → ADR rationale → worked example → gotchas) — NOT a condensed README paste. Trigger when adding or changing a capability that ships user-facing behaviour, when editing README feature tables / changelog / roadmap (R45 doc-site parity), when adding a page to /docs-site/, or when editing docs.json navigation.
CONSUMER-SIDE template — use in a consumer repository that posts knowledge to AskMyDocs, NOT when editing AskMyDocs itself. Triggers when the team wants to bootstrap or refresh the ENTIRE canonical knowledge base of a repository in one pass: survey the codebase, plan the typed-document inventory, and emit a full cross-wikilinked kb/ tree (project-index + modules + decisions + standards + integrations + domain-concepts + runbooks + rejected-approaches). Draft only — produces Markdown files under kb/ for human review, never commits and never POSTs. Example triggers: generate the canonical docs for this repo, compile the knowledge base, bootstrap kb/ from the codebase, document the whole project in canonical mode.
Order test tearDown so the RefreshDatabase rollback runs BEFORE Mockery::close(), so an unmet mock expectation can never skip the rollback and cascade an "active transaction" suite-wide failure (R41).
Every tenant-aware Eloquent model in app/Models/ MUST `use BelongsToTenant;` and have `tenant_id` in $fillable (or use `$guarded = ['id']`). The TenantContext singleton is set by ResolveTenant middleware (HTTP) or `--tenant=X` CLI option. v3 backward compat is preserved by `default 'default'` everywhere. Trigger when adding a new Eloquent model under app/Models/, when modifying $fillable on an existing model, when creating a new migration that adds a domain table, or when reviewing PRs that touch persistence.