@invictus-group-ai/orchestra 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/LICENSING.md +49 -0
- package/README.md +507 -0
- package/assets/settings-template.json +99 -0
- package/bin/invi.js +6 -0
- package/content-dist/LICENSE +95 -0
- package/content-dist/PIPELINE.md +823 -0
- package/content-dist/README.md +128 -0
- package/content-dist/agents/README.md +135 -0
- package/content-dist/agents/mapping.json +476 -0
- package/content-dist/agents/stacks/backend-django.md +66 -0
- package/content-dist/agents/stacks/backend-dotnet.md +72 -0
- package/content-dist/agents/stacks/backend-fastapi.md +66 -0
- package/content-dist/agents/stacks/backend-laravel.md +66 -0
- package/content-dist/agents/stacks/backend-node.md +66 -0
- package/content-dist/agents/stacks/backend-spring.md +66 -0
- package/content-dist/agents/stacks/desktop-delphi.md +73 -0
- package/content-dist/agents/stacks/frontend-angular.md +65 -0
- package/content-dist/agents/stacks/frontend-react.md +67 -0
- package/content-dist/agents/stacks/frontend-svelte.md +67 -0
- package/content-dist/agents/stacks/frontend-vue.md +66 -0
- package/content-dist/agents/stacks/mobile-flutter.md +68 -0
- package/content-dist/agents/stacks/wordpress.md +66 -0
- package/content-dist/agents/universal/invi-qa.md +57 -0
- package/content-dist/agents/universal/invi-reviewer.md +61 -0
- package/content-dist/agents/universal/invi-security.md +55 -0
- package/content-dist/agents/universal/invi-tester.md +55 -0
- package/content-dist/agents/universal/invi-ui.md +85 -0
- package/content-dist/fragments/base.md +37 -0
- package/content-dist/fragments/domain/api-publica-rate-limiting.md +83 -0
- package/content-dist/fragments/domain/autenticacao-enterprise.md +86 -0
- package/content-dist/fragments/domain/busca-elasticsearch.md +86 -0
- package/content-dist/fragments/domain/dashboard-admin-rbac.md +80 -0
- package/content-dist/fragments/domain/design-system.md +71 -0
- package/content-dist/fragments/domain/ecommerce-completo.md +86 -0
- package/content-dist/fragments/domain/filas-jobs.md +80 -0
- package/content-dist/fragments/domain/integracao-crm-erp.md +82 -0
- package/content-dist/fragments/domain/lgpd.md +84 -0
- package/content-dist/fragments/domain/multi-tenancy.md +79 -0
- package/content-dist/fragments/domain/notificacoes-multicanal.md +81 -0
- package/content-dist/fragments/domain/pagamentos-brasil.md +85 -0
- package/content-dist/fragments/domain/plataforma-conteudo.md +77 -0
- package/content-dist/fragments/domain/realtime-websockets.md +92 -0
- package/content-dist/fragments/domain/relatorios-analytics.md +80 -0
- package/content-dist/fragments/domain/saas-stripe-billing.md +79 -0
- package/content-dist/fragments/domain/sistema-pagamentos.md +81 -0
- package/content-dist/fragments/domain/upload-midia.md +81 -0
- package/content-dist/fragments/domain/whatsapp-business.md +82 -0
- package/content-dist/fragments/index.json +1670 -0
- package/content-dist/fragments/references/angular-ngrx/app-config-and-testing.md +81 -0
- package/content-dist/fragments/references/angular-ngrx/store-pattern.md +155 -0
- package/content-dist/fragments/references/ansible-server-setup/layout-and-config.md +143 -0
- package/content-dist/fragments/references/ansible-server-setup/roles.md +238 -0
- package/content-dist/fragments/references/api-publica-rate-limiting/patterns.md +68 -0
- package/content-dist/fragments/references/astro-static/content-and-islands.md +117 -0
- package/content-dist/fragments/references/autenticacao-enterprise/pitfalls.md +70 -0
- package/content-dist/fragments/references/busca-elasticsearch/patterns.md +100 -0
- package/content-dist/fragments/references/chrome-extension-mv3/messaging-and-storage.md +109 -0
- package/content-dist/fragments/references/cli-typescript-commander/commands-and-config.md +136 -0
- package/content-dist/fragments/references/cloud-run-gcp/build-and-deploy.md +127 -0
- package/content-dist/fragments/references/cloud-run-gcp/iam-secrets-networking.md +65 -0
- package/content-dist/fragments/references/computer-vision-yolo/serving-and-export.md +182 -0
- package/content-dist/fragments/references/computer-vision-yolo/training-and-validation.md +131 -0
- package/content-dist/fragments/references/convex-react/functions.md +117 -0
- package/content-dist/fragments/references/convex-react/react-and-storage.md +109 -0
- package/content-dist/fragments/references/dashboard-admin-rbac/patterns.md +73 -0
- package/content-dist/fragments/references/data-pipeline-airflow/dag-patterns.md +149 -0
- package/content-dist/fragments/references/data-pipeline-airflow/operations.md +74 -0
- package/content-dist/fragments/references/delphi-object-pascal/legacy-extraction.md +175 -0
- package/content-dist/fragments/references/django-drf-celery/celery-tasks.md +47 -0
- package/content-dist/fragments/references/django-drf-celery/viewsets-and-serializers.md +92 -0
- package/content-dist/fragments/references/docker-compose-dev/compose-files.md +146 -0
- package/content-dist/fragments/references/docker-compose-dev/dockerfile-and-proxy.md +108 -0
- package/content-dist/fragments/references/dotnet-aspnet/data-and-di.md +90 -0
- package/content-dist/fragments/references/dotnet-aspnet/web-layer.md +88 -0
- package/content-dist/fragments/references/ecommerce-completo/patterns.md +76 -0
- package/content-dist/fragments/references/electron-app/ipc-bridge.md +123 -0
- package/content-dist/fragments/references/electron-app/security-and-packaging.md +134 -0
- package/content-dist/fragments/references/elixir-phoenix/context-and-web.md +112 -0
- package/content-dist/fragments/references/elixir-phoenix/processes.md +65 -0
- package/content-dist/fragments/references/filas-jobs/patterns.md +116 -0
- package/content-dist/fragments/references/fine-tuning-huggingface/data-and-export.md +114 -0
- package/content-dist/fragments/references/fine-tuning-huggingface/training-and-lora.md +123 -0
- package/content-dist/fragments/references/flutter/platform-channels-and-goldens.md +68 -0
- package/content-dist/fragments/references/flutter/state-and-widgets.md +95 -0
- package/content-dist/fragments/references/github-actions-cicd/workflows.md +235 -0
- package/content-dist/fragments/references/go-chi-gorm/http-layer.md +87 -0
- package/content-dist/fragments/references/go-chi-gorm/service-layer.md +58 -0
- package/content-dist/fragments/references/graphql-apollo/resolvers-and-loaders.md +128 -0
- package/content-dist/fragments/references/hono-bun/patterns.md +144 -0
- package/content-dist/fragments/references/integracao-crm-erp/patterns.md +100 -0
- package/content-dist/fragments/references/kubernetes-helm/chart-templates.md +162 -0
- package/content-dist/fragments/references/kubernetes-helm/secrets-storage-deploy.md +78 -0
- package/content-dist/fragments/references/langchain-python-agent/agent-and-cost.md +120 -0
- package/content-dist/fragments/references/langchain-python-agent/memory-and-resilience.md +76 -0
- package/content-dist/fragments/references/laravel/eloquent-and-queues.md +126 -0
- package/content-dist/fragments/references/laravel/http-layer.md +110 -0
- package/content-dist/fragments/references/lgpd/patterns.md +110 -0
- package/content-dist/fragments/references/llm-ops-production/routing-and-budget.md +118 -0
- package/content-dist/fragments/references/llm-ops-production/tracing-eval-ab.md +102 -0
- package/content-dist/fragments/references/microservices-docker/compose-and-gateway.md +93 -0
- package/content-dist/fragments/references/microservices-docker/events-and-correlation.md +88 -0
- package/content-dist/fragments/references/ml-fastapi-serving/metrics-drift-docker.md +97 -0
- package/content-dist/fragments/references/ml-fastapi-serving/serving-core.md +155 -0
- package/content-dist/fragments/references/ml-training-pipeline/dvc-pipeline.md +102 -0
- package/content-dist/fragments/references/ml-training-pipeline/mlflow-registry-ci.md +139 -0
- package/content-dist/fragments/references/monitoring-observability/alerts-and-config.md +169 -0
- package/content-dist/fragments/references/monitoring-observability/instrumentation-node.md +139 -0
- package/content-dist/fragments/references/multi-tenancy/patterns.md +85 -0
- package/content-dist/fragments/references/nestjs-typescript/guards-and-decorators.md +103 -0
- package/content-dist/fragments/references/nestjs-typescript/modules-dtos-setup.md +106 -0
- package/content-dist/fragments/references/nextjs-app-router/patterns.md +177 -0
- package/content-dist/fragments/references/nextjs-prisma-postgres/billing.md +167 -0
- package/content-dist/fragments/references/nextjs-trpc-drizzle/data-and-auth.md +121 -0
- package/content-dist/fragments/references/nextjs-trpc-drizzle/trpc-setup.md +62 -0
- package/content-dist/fragments/references/nodejs-express-typescript/config-and-tokens.md +48 -0
- package/content-dist/fragments/references/nodejs-express-typescript/middleware.md +108 -0
- package/content-dist/fragments/references/notificacoes-multicanal/patterns.md +78 -0
- package/content-dist/fragments/references/nuxt3-tailwind/server-routes.md +79 -0
- package/content-dist/fragments/references/nuxt3-tailwind/state-and-fetching.md +129 -0
- package/content-dist/fragments/references/openai-api-integration/calls.md +210 -0
- package/content-dist/fragments/references/openai-api-integration/client-and-cost.md +71 -0
- package/content-dist/fragments/references/pagamentos-brasil/gateways-reconciliation.md +92 -0
- package/content-dist/fragments/references/pagamentos-brasil/pix-boleto.md +115 -0
- package/content-dist/fragments/references/plataforma-conteudo/patterns.md +74 -0
- package/content-dist/fragments/references/python-fastapi/dependency-injection.md +99 -0
- package/content-dist/fragments/references/python-fastapi/settings-and-tasks.md +47 -0
- package/content-dist/fragments/references/rag-pipeline/ingestion.md +92 -0
- package/content-dist/fragments/references/rag-pipeline/retrieval-and-eval.md +148 -0
- package/content-dist/fragments/references/react-express-monolith/auth-and-client.md +110 -0
- package/content-dist/fragments/references/react-express-monolith/monorepo.md +71 -0
- package/content-dist/fragments/references/react-native-expo/native-patterns.md +103 -0
- package/content-dist/fragments/references/react-native-expo/navigation-and-auth.md +55 -0
- package/content-dist/fragments/references/react-ts-zustand-query/store-and-query.md +152 -0
- package/content-dist/fragments/references/react-typescript/feature-module.md +64 -0
- package/content-dist/fragments/references/react-typescript/forms-and-state.md +69 -0
- package/content-dist/fragments/references/react-typescript/recipes.md +37 -0
- package/content-dist/fragments/references/react-typescript/testing.md +40 -0
- package/content-dist/fragments/references/realtime-websockets/patterns.md +92 -0
- package/content-dist/fragments/references/relatorios-analytics/patterns.md +81 -0
- package/content-dist/fragments/references/remix-express-full/auth-and-uploads.md +88 -0
- package/content-dist/fragments/references/remix-express-full/express-server.md +54 -0
- package/content-dist/fragments/references/remix-typescript/auth-and-db.md +68 -0
- package/content-dist/fragments/references/remix-typescript/loaders-and-actions.md +98 -0
- package/content-dist/fragments/references/rust-axum/error-and-state.md +99 -0
- package/content-dist/fragments/references/rust-axum/handlers.md +87 -0
- package/content-dist/fragments/references/saas-stripe-billing/patterns.md +86 -0
- package/content-dist/fragments/references/serverless-lambda/handler-patterns.md +107 -0
- package/content-dist/fragments/references/sistema-pagamentos/pitfalls.md +54 -0
- package/content-dist/fragments/references/spring-boot/service-and-data.md +96 -0
- package/content-dist/fragments/references/spring-boot/web-layer.md +100 -0
- package/content-dist/fragments/references/supabase-nextjs/clients-and-middleware.md +102 -0
- package/content-dist/fragments/references/supabase-nextjs/rls-and-storage.md +86 -0
- package/content-dist/fragments/references/svelte-sveltekit/hooks-and-state.md +67 -0
- package/content-dist/fragments/references/svelte-sveltekit/load-and-actions.md +80 -0
- package/content-dist/fragments/references/t3-stack/routers-and-callers.md +75 -0
- package/content-dist/fragments/references/t3-stack/trpc-setup.md +60 -0
- package/content-dist/fragments/references/terraform-aws/modules-and-ci.md +114 -0
- package/content-dist/fragments/references/terraform-aws/state-and-workspaces.md +66 -0
- package/content-dist/fragments/references/turborepo-monorepo/pipeline-and-packages.md +84 -0
- package/content-dist/fragments/references/upload-midia/patterns.md +80 -0
- package/content-dist/fragments/references/vector-search-pinecone/client-and-upsert.md +98 -0
- package/content-dist/fragments/references/vector-search-pinecone/query-and-hybrid.md +81 -0
- package/content-dist/fragments/references/vps-deploy-producao/compose-prod.md +97 -0
- package/content-dist/fragments/references/vps-deploy-producao/proxy-and-operations.md +118 -0
- package/content-dist/fragments/references/vscode-extension/activation-and-tree.md +98 -0
- package/content-dist/fragments/references/vscode-extension/webview-csp.md +57 -0
- package/content-dist/fragments/references/vue3-pinia-vite/components-and-stores.md +73 -0
- package/content-dist/fragments/references/vue3-pinia-vite/queries-forms-testing.md +100 -0
- package/content-dist/fragments/references/whatsapp-business/patterns.md +107 -0
- package/content-dist/fragments/references/wordpress/hooks-and-security.md +92 -0
- package/content-dist/fragments/references/wordpress/wp-cli-gates.md +64 -0
- package/content-dist/fragments/stack/angular-ngrx.md +75 -0
- package/content-dist/fragments/stack/ansible-server-setup.md +69 -0
- package/content-dist/fragments/stack/astro-static.md +72 -0
- package/content-dist/fragments/stack/chrome-extension-mv3.md +66 -0
- package/content-dist/fragments/stack/cli-typescript-commander.md +66 -0
- package/content-dist/fragments/stack/cloud-run-gcp.md +63 -0
- package/content-dist/fragments/stack/computer-vision-yolo.md +62 -0
- package/content-dist/fragments/stack/convex-react.md +65 -0
- package/content-dist/fragments/stack/data-pipeline-airflow.md +64 -0
- package/content-dist/fragments/stack/delphi-object-pascal.md +63 -0
- package/content-dist/fragments/stack/django-drf-celery.md +63 -0
- package/content-dist/fragments/stack/docker-compose-dev.md +69 -0
- package/content-dist/fragments/stack/dotnet-aspnet.md +62 -0
- package/content-dist/fragments/stack/electron-app.md +70 -0
- package/content-dist/fragments/stack/elixir-phoenix.md +65 -0
- package/content-dist/fragments/stack/fine-tuning-huggingface.md +69 -0
- package/content-dist/fragments/stack/flutter.md +61 -0
- package/content-dist/fragments/stack/github-actions-cicd.md +73 -0
- package/content-dist/fragments/stack/go-chi-gorm.md +73 -0
- package/content-dist/fragments/stack/graphql-apollo.md +70 -0
- package/content-dist/fragments/stack/hono-bun.md +62 -0
- package/content-dist/fragments/stack/kubernetes-helm.md +67 -0
- package/content-dist/fragments/stack/langchain-python-agent.md +64 -0
- package/content-dist/fragments/stack/laravel.md +64 -0
- package/content-dist/fragments/stack/llm-ops-production.md +63 -0
- package/content-dist/fragments/stack/microservices-docker.md +70 -0
- package/content-dist/fragments/stack/ml-fastapi-serving.md +64 -0
- package/content-dist/fragments/stack/ml-training-pipeline.md +67 -0
- package/content-dist/fragments/stack/monitoring-observability.md +68 -0
- package/content-dist/fragments/stack/nestjs-typescript.md +68 -0
- package/content-dist/fragments/stack/nextjs-app-router.md +65 -0
- package/content-dist/fragments/stack/nextjs-prisma-postgres.md +61 -0
- package/content-dist/fragments/stack/nextjs-trpc-drizzle.md +63 -0
- package/content-dist/fragments/stack/nodejs-express-typescript.md +60 -0
- package/content-dist/fragments/stack/nuxt3-tailwind.md +62 -0
- package/content-dist/fragments/stack/openai-api-integration.md +58 -0
- package/content-dist/fragments/stack/python-fastapi.md +64 -0
- package/content-dist/fragments/stack/rag-pipeline.md +62 -0
- package/content-dist/fragments/stack/react-express-monolith.md +61 -0
- package/content-dist/fragments/stack/react-native-expo.md +68 -0
- package/content-dist/fragments/stack/react-ts-zustand-query.md +64 -0
- package/content-dist/fragments/stack/react-typescript.md +73 -0
- package/content-dist/fragments/stack/remix-express-full.md +63 -0
- package/content-dist/fragments/stack/remix-typescript.md +66 -0
- package/content-dist/fragments/stack/rust-axum.md +63 -0
- package/content-dist/fragments/stack/serverless-lambda.md +65 -0
- package/content-dist/fragments/stack/spring-boot.md +63 -0
- package/content-dist/fragments/stack/supabase-nextjs.md +64 -0
- package/content-dist/fragments/stack/svelte-sveltekit.md +67 -0
- package/content-dist/fragments/stack/t3-stack.md +63 -0
- package/content-dist/fragments/stack/terraform-aws.md +65 -0
- package/content-dist/fragments/stack/turborepo-monorepo.md +61 -0
- package/content-dist/fragments/stack/vector-search-pinecone.md +63 -0
- package/content-dist/fragments/stack/vps-deploy-producao.md +64 -0
- package/content-dist/fragments/stack/vscode-extension.md +64 -0
- package/content-dist/fragments/stack/vue3-pinia-vite.md +65 -0
- package/content-dist/fragments/stack/wordpress.md +63 -0
- package/content-dist/skills/invi-commit/SKILL.md +85 -0
- package/content-dist/skills/invi-journal/SKILL.md +67 -0
- package/content-dist/skills/invi-map/SKILL.md +118 -0
- package/content-dist/skills/invi-mode/SKILL.md +176 -0
- package/content-dist/skills/invi-pr/SKILL.md +142 -0
- package/content-dist/skills/invi-qa/SKILL.md +75 -0
- package/content-dist/skills/invi-refactor-legacy/SKILL.md +90 -0
- package/content-dist/skills/invi-review/SKILL.md +83 -0
- package/content-dist/skills/invi-security/SKILL.md +89 -0
- package/content-dist/skills/invi-status/SKILL.md +72 -0
- package/content-dist/skills/invi-task/SKILL.md +143 -0
- package/content-dist/skills/invi-test/SKILL.md +97 -0
- package/content-dist/skills/po-handoff/SKILL.md +130 -0
- package/content-dist/skills/po-intake/SKILL.md +115 -0
- package/content-dist/skills/po-lint/SKILL.md +82 -0
- package/content-dist/skills/po-spec/SKILL.md +138 -0
- package/content-dist/skills/po-status/SKILL.md +130 -0
- package/content-dist/skills/po-verify/SKILL.md +124 -0
- package/content-dist/templates/requirements/REQ-TEMPLATE.md +110 -0
- package/content-dist/templates/requirements/constitution-TEMPLATE.md +77 -0
- package/dist/baseline.d.ts +21 -0
- package/dist/baseline.d.ts.map +1 -0
- package/dist/baseline.js +43 -0
- package/dist/baseline.js.map +1 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +345 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/doctor.d.ts +31 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +173 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/export.d.ts +49 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +95 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/gate.d.ts +42 -0
- package/dist/commands/gate.d.ts.map +1 -0
- package/dist/commands/gate.js +97 -0
- package/dist/commands/gate.js.map +1 -0
- package/dist/commands/init.d.ts +88 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +540 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/journalCmd.d.ts +47 -0
- package/dist/commands/journalCmd.d.ts.map +1 -0
- package/dist/commands/journalCmd.js +89 -0
- package/dist/commands/journalCmd.js.map +1 -0
- package/dist/commands/keys.d.ts +68 -0
- package/dist/commands/keys.d.ts.map +1 -0
- package/dist/commands/keys.js +240 -0
- package/dist/commands/keys.js.map +1 -0
- package/dist/commands/map.d.ts +123 -0
- package/dist/commands/map.d.ts.map +1 -0
- package/dist/commands/map.js +383 -0
- package/dist/commands/map.js.map +1 -0
- package/dist/commands/plan.d.ts +28 -0
- package/dist/commands/plan.d.ts.map +1 -0
- package/dist/commands/plan.js +64 -0
- package/dist/commands/plan.js.map +1 -0
- package/dist/commands/req.d.ts +92 -0
- package/dist/commands/req.d.ts.map +1 -0
- package/dist/commands/req.js +270 -0
- package/dist/commands/req.js.map +1 -0
- package/dist/commands/review.d.ts +40 -0
- package/dist/commands/review.d.ts.map +1 -0
- package/dist/commands/review.js +101 -0
- package/dist/commands/review.js.map +1 -0
- package/dist/commands/run.d.ts +33 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +151 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/ship.d.ts +45 -0
- package/dist/commands/ship.d.ts.map +1 -0
- package/dist/commands/ship.js +252 -0
- package/dist/commands/ship.js.map +1 -0
- package/dist/commands/status.d.ts +36 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +152 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/sync.d.ts +91 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +331 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/syncCommits.d.ts +56 -0
- package/dist/commands/syncCommits.d.ts.map +1 -0
- package/dist/commands/syncCommits.js +97 -0
- package/dist/commands/syncCommits.js.map +1 -0
- package/dist/commands/task.d.ts +108 -0
- package/dist/commands/task.d.ts.map +1 -0
- package/dist/commands/task.js +217 -0
- package/dist/commands/task.js.map +1 -0
- package/dist/commands/update.d.ts +92 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +541 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/verifyTask.d.ts +50 -0
- package/dist/commands/verifyTask.d.ts.map +1 -0
- package/dist/commands/verifyTask.js +172 -0
- package/dist/commands/verifyTask.js.map +1 -0
- package/dist/content.d.ts +128 -0
- package/dist/content.d.ts.map +1 -0
- package/dist/content.js +177 -0
- package/dist/content.js.map +1 -0
- package/dist/detect.d.ts +122 -0
- package/dist/detect.d.ts.map +1 -0
- package/dist/detect.js +594 -0
- package/dist/detect.js.map +1 -0
- package/dist/events.d.ts +36 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +76 -0
- package/dist/events.js.map +1 -0
- package/dist/frontmatter.d.ts +15 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/frontmatter.js +74 -0
- package/dist/frontmatter.js.map +1 -0
- package/dist/i18n/en.d.ts +421 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +443 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/index.d.ts +40 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +66 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/pt-BR.d.ts +11 -0
- package/dist/i18n/pt-BR.d.ts.map +1 -0
- package/dist/i18n/pt-BR.js +435 -0
- package/dist/i18n/pt-BR.js.map +1 -0
- package/dist/identity.d.ts +78 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +152 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +48 -0
- package/dist/index.js.map +1 -0
- package/dist/insights.d.ts +86 -0
- package/dist/insights.d.ts.map +1 -0
- package/dist/insights.js +199 -0
- package/dist/insights.js.map +1 -0
- package/dist/interview.d.ts +81 -0
- package/dist/interview.d.ts.map +1 -0
- package/dist/interview.js +283 -0
- package/dist/interview.js.map +1 -0
- package/dist/inventory.d.ts +79 -0
- package/dist/inventory.d.ts.map +1 -0
- package/dist/inventory.js +86 -0
- package/dist/inventory.js.map +1 -0
- package/dist/journal.d.ts +22 -0
- package/dist/journal.d.ts.map +1 -0
- package/dist/journal.js +88 -0
- package/dist/journal.js.map +1 -0
- package/dist/migrations/legacyNames.d.ts +45 -0
- package/dist/migrations/legacyNames.d.ts.map +1 -0
- package/dist/migrations/legacyNames.js +118 -0
- package/dist/migrations/legacyNames.js.map +1 -0
- package/dist/plan.d.ts +42 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +126 -0
- package/dist/plan.js.map +1 -0
- package/dist/render/agents.d.ts +327 -0
- package/dist/render/agents.d.ts.map +1 -0
- package/dist/render/agents.js +356 -0
- package/dist/render/agents.js.map +1 -0
- package/dist/render/claudeMd.d.ts +29 -0
- package/dist/render/claudeMd.d.ts.map +1 -0
- package/dist/render/claudeMd.js +110 -0
- package/dist/render/claudeMd.js.map +1 -0
- package/dist/render/githooks.d.ts +41 -0
- package/dist/render/githooks.d.ts.map +1 -0
- package/dist/render/githooks.js +168 -0
- package/dist/render/githooks.js.map +1 -0
- package/dist/render/markers.d.ts +13 -0
- package/dist/render/markers.d.ts.map +1 -0
- package/dist/render/markers.js +35 -0
- package/dist/render/markers.js.map +1 -0
- package/dist/render/requirements.d.ts +56 -0
- package/dist/render/requirements.d.ts.map +1 -0
- package/dist/render/requirements.js +86 -0
- package/dist/render/requirements.js.map +1 -0
- package/dist/render/settings.d.ts +43 -0
- package/dist/render/settings.d.ts.map +1 -0
- package/dist/render/settings.js +94 -0
- package/dist/render/settings.js.map +1 -0
- package/dist/render/transparency.d.ts +7 -0
- package/dist/render/transparency.d.ts.map +1 -0
- package/dist/render/transparency.js +164 -0
- package/dist/render/transparency.js.map +1 -0
- package/dist/requirements.d.ts +84 -0
- package/dist/requirements.d.ts.map +1 -0
- package/dist/requirements.js +229 -0
- package/dist/requirements.js.map +1 -0
- package/dist/sizing.d.ts +63 -0
- package/dist/sizing.d.ts.map +1 -0
- package/dist/sizing.js +104 -0
- package/dist/sizing.js.map +1 -0
- package/dist/tasks.d.ts +199 -0
- package/dist/tasks.d.ts.map +1 -0
- package/dist/tasks.js +320 -0
- package/dist/tasks.js.map +1 -0
- package/dist/util/diff3.d.ts +26 -0
- package/dist/util/diff3.d.ts.map +1 -0
- package/dist/util/diff3.js +112 -0
- package/dist/util/diff3.js.map +1 -0
- package/dist/util/fsx.d.ts +33 -0
- package/dist/util/fsx.d.ts.map +1 -0
- package/dist/util/fsx.js +153 -0
- package/dist/util/fsx.js.map +1 -0
- package/dist/util/git.d.ts +58 -0
- package/dist/util/git.d.ts.map +1 -0
- package/dist/util/git.js +171 -0
- package/dist/util/git.js.map +1 -0
- package/dist/util/merge.d.ts +27 -0
- package/dist/util/merge.d.ts.map +1 -0
- package/dist/util/merge.js +78 -0
- package/dist/util/merge.js.map +1 -0
- package/dist/util/out.d.ts +18 -0
- package/dist/util/out.d.ts.map +1 -0
- package/dist/util/out.js +23 -0
- package/dist/util/out.js.map +1 -0
- package/dist/util/proc.d.ts +12 -0
- package/dist/util/proc.d.ts.map +1 -0
- package/dist/util/proc.js +45 -0
- package/dist/util/proc.js.map +1 -0
- package/dist/util/registry.d.ts +58 -0
- package/dist/util/registry.d.ts.map +1 -0
- package/dist/util/registry.js +240 -0
- package/dist/util/registry.js.map +1 -0
- package/dist/verify.d.ts +52 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +205 -0
- package/dist/verify.js.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +18 -0
- package/dist/version.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: invi-wordpress
|
|
3
|
+
description: WordPress/WooCommerce specialist for {{PROJECT_NAME}}. Use PROACTIVELY for hooks, child-theme templates, site/mu-plugins, shortcodes, admin/AJAX/REST endpoints, and WooCommerce extensions in the WordPress workspace. Knows the project's conventions, the sanitize/escape/nonce discipline, and the WP-CLI verification workflow.
|
|
4
|
+
tools: Read, Edit, Write, Bash, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are a senior WordPress engineer on **{{PROJECT_NAME}}**. You write idiomatic WordPress/WooCommerce PHP that looks like the surrounding code and survives every core, theme, and plugin update.
|
|
8
|
+
|
|
9
|
+
## Standing rules
|
|
10
|
+
|
|
11
|
+
- Communicate with the user in the language configured in `.invictus/manifest.json` (`language.render`; default pt-BR). Identifiers and hook names follow the neighboring code's language; user-facing strings go through the i18n functions with the project text domain.
|
|
12
|
+
- One task = one branch = one goal. Make the smallest coherent change.
|
|
13
|
+
- If the environment cannot run WP-CLI or the tests, say "not verified in this environment" and give the exact command — never claim a pass you did not see.
|
|
14
|
+
- Read the `.invictus/codebase/` documents (architecture, conventions, concerns) when they exist — do not re-derive what is already documented.
|
|
15
|
+
|
|
16
|
+
## Architecture map
|
|
17
|
+
|
|
18
|
+
{{ARCHITECTURE_SUMMARY}}
|
|
19
|
+
|
|
20
|
+
All customization lives in the child theme or a site-specific/mu-plugin and attaches via actions/filters. Core, parent themes, and third-party plugins are NEVER edited — a change needed there is a hook, a child-theme override, or an upstream issue, never a patch.
|
|
21
|
+
|
|
22
|
+
## Project conventions (mandatory)
|
|
23
|
+
|
|
24
|
+
{{CONVENTIONS_SUMMARY}}
|
|
25
|
+
|
|
26
|
+
## Data access
|
|
27
|
+
|
|
28
|
+
{{DATA_ACCESS_RULES}}
|
|
29
|
+
|
|
30
|
+
Queries go through `WP_Query`/core APIs; anything touching tables directly uses `$wpdb->prepare()` with placeholders — NEVER interpolate input into SQL, not even "safe-looking" IDs. Schema changes (custom tables, dbDelta) are a documented decision a human applies — never ad hoc DDL (the db-guard hook blocks it anyway).
|
|
31
|
+
|
|
32
|
+
## Named catastrophic risk
|
|
33
|
+
|
|
34
|
+
**{{CATASTROPHIC_RISK}}** — any change to capability checks, login/roles, checkout/payment flows, or data-exposing endpoints must demonstrably preserve it. Flag such changes for review explicitly.
|
|
35
|
+
|
|
36
|
+
## WordPress discipline (hard rules)
|
|
37
|
+
|
|
38
|
+
- Hooks over edits: behavior changes are `add_action`/`add_filter` in the child theme or the site plugin; template changes are child-theme overrides; must-always-run infrastructure code is an mu-plugin. Prefix/namespace everything per the repo convention; files register hooks at load and run on events — no side effects at include time.
|
|
39
|
+
- The sanitize/escape/nonce trinity on EVERY input path: sanitize on input (`sanitize_*`, `wp_kses`), escape on output (`esc_html`/`esc_attr`/`esc_url`), verify intent (nonce + `current_user_can()`) on every state-changing action — admin-post, AJAX, and REST alike. REST routes declare a real `permission_callback`; `__return_true` only for genuinely public read-only data.
|
|
40
|
+
- Assets are enqueued (`wp_enqueue_script`/`wp_enqueue_style`) with declared dependencies and versions — never hardcoded tags in templates.
|
|
41
|
+
- WooCommerce: extend only through its hooks and documented extension points (gateway/shipping classes, `woocommerce_*` filters, template overrides under the theme's `woocommerce/` dir) — never edit WooCommerce core, and go through its CRUD/data stores (`WC_Order`, `WC_Product`) instead of raw postmeta when a CRUD API exists.
|
|
42
|
+
- Slow work (imports, emails, API syncs) runs via the repo's cron/queue pattern (Action Scheduler where WooCommerce provides it) — never inline in a page request.
|
|
43
|
+
|
|
44
|
+
## Workflow
|
|
45
|
+
|
|
46
|
+
1. Locate the module ({{MODULE_LIST}}) and read a neighboring hook/template/endpoint of the same kind — copy the exact pattern. Good exemplars: {{REFERENCE_FILES}}.
|
|
47
|
+
2. Make the smallest coherent change following the conventions and discipline above.
|
|
48
|
+
3. Verify with `WP_DEBUG` + `WP_DEBUG_LOG` enabled: exercise the changed path and confirm a clean debug.log — a notice/deprecation you introduced is a defect. Drive the mechanics through WP-CLI (`wp plugin list`, `wp theme list`, `wp eval`, `wp cache flush`) instead of clicking through wp-admin, and state what you ran.
|
|
49
|
+
4. Hand test-writing to the **invi-tester** agent ({{TEST_FRAMEWORKS}}); logic touching the fragile areas ({{FRAGILE_AREAS}}) gets tests in the same branch.
|
|
50
|
+
5. Validate with {{BUILD_COMMANDS}} and {{TEST_COMMANDS}} when the environment permits; otherwise state exactly what must be run.
|
|
51
|
+
|
|
52
|
+
## Report
|
|
53
|
+
|
|
54
|
+
Files changed, conventions applied, risks (catastrophic-risk exposure, fragile areas touched, unsanitized input / unescaped output / missing nonce or capability check introduced — there should be none), tests still missing. Close with exactly one result block (grammar: `content/PIPELINE.md` §5; `BLOCK: BUILD` is the agent-level extension defined in `content/agents/README.md` — machine values stay EN; empty ⇒ `-`):
|
|
55
|
+
|
|
56
|
+
```INVICTUS-RESULT
|
|
57
|
+
BLOCK: BUILD
|
|
58
|
+
AGENT: invi-wordpress
|
|
59
|
+
TASK: <ticket id or ->
|
|
60
|
+
STATUS: <done | blocked>
|
|
61
|
+
FILES: <changed paths>
|
|
62
|
+
VERIFIED: <commands run and results, or not-verified>
|
|
63
|
+
RISKS: <list or ->
|
|
64
|
+
TESTS_MISSING: <list or ->
|
|
65
|
+
NEXT: <one line>
|
|
66
|
+
```
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: invi-qa
|
|
3
|
+
description: QA analyst for {{PROJECT_NAME}}. Use to validate a delivery against the ticket's acceptance criteria before merge. Derives test cases per criterion, exercises build/tests, checks regression in the fragile areas, and issues a verdict report. Complements — never replaces — automated tests. Never edits production code.
|
|
4
|
+
tools: Read, Grep, Glob, Bash, Write
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the QA analyst for **{{PROJECT_NAME}}**. Your job: ensure the delivery does what the ticket asked, without regressions. **You think like a user and like an adversary.**
|
|
8
|
+
|
|
9
|
+
## Standing rules
|
|
10
|
+
|
|
11
|
+
- Communicate with the user in the language configured in `.invictus/manifest.json` (`language.render`; default pt-BR).
|
|
12
|
+
- Report faithfully: if a step was skipped or could not be verified, say so. A toolchain the environment lacks means "not verified in this environment" — **never fake a pass**.
|
|
13
|
+
- **Never edit production code.** If a fix is needed, report it and delegate to the appropriate builder agent. The only file you may write is the QA report.
|
|
14
|
+
- Your verdict feeds a gate with a bounded fix loop (max 2 fix cycles, then the task is blocked and reported). Merge is always a human decision.
|
|
15
|
+
- Read the `.invictus/codebase/` documents (testing, concerns) when they exist.
|
|
16
|
+
|
|
17
|
+
## Inputs
|
|
18
|
+
|
|
19
|
+
- The acceptance criteria — from the task plan or ticket text the caller provides. If absent, ask for them, or record their absence and validate against the ticket description.
|
|
20
|
+
- The branch diff: `git diff <base>...HEAD`, where `<base>` is `project.baseBranch` from `.invictus/manifest.json`.
|
|
21
|
+
|
|
22
|
+
## Process
|
|
23
|
+
|
|
24
|
+
1. **Derive test cases per acceptance criterion.** For each criterion list the scenarios: happy path, edge cases, invalid input, permission denied, and the catastrophic-risk scenario — {{CATASTROPHIC_RISK}} — even when the ticket doesn't mention it.
|
|
25
|
+
2. **Automated verification** — run what the environment permits:
|
|
26
|
+
- Tests: {{TEST_COMMANDS}}
|
|
27
|
+
- Build: {{BUILD_COMMANDS}}
|
|
28
|
+
If an SDK/runtime is missing, record "not verified in this environment" with the exact command a human/CI must run — do not pretend it passed.
|
|
29
|
+
3. **Quality checklist:**
|
|
30
|
+
- Every acceptance criterion met? (yes/no per item, with evidence.)
|
|
31
|
+
- Automated tests covering the new behavior? (if not, name the gap.)
|
|
32
|
+
- Regression: does the change touch a fragile area ({{FRAGILE_AREAS}})? If so, name the existing flows that must be re-checked.
|
|
33
|
+
- Error contract coherent (status codes/result shape per the project conventions); user-facing messages in the product's language.
|
|
34
|
+
- No versioned secret; no leftover debug output.
|
|
35
|
+
4. **Verdict report:** write it to the path the caller indicates (default `.invictus/tasks/<id>/qa.md`) with: summary, criterion × result table, bugs found (reproduction steps + expected vs. actual), regression risks, and the verdict **APPROVE / WITH_RESERVATIONS / REJECT**.
|
|
36
|
+
|
|
37
|
+
## Principles
|
|
38
|
+
|
|
39
|
+
- A bug report = reproduction steps + expected × actual result. No vague "seems broken".
|
|
40
|
+
- Distinguish "verified and passed", "verified and failed", and "not verified" — three different facts; never blur them.
|
|
41
|
+
|
|
42
|
+
## Output
|
|
43
|
+
|
|
44
|
+
Deliver the report path and a summary, then close with exactly one result block (grammar: `content/PIPELINE.md` §5 — machine values stay EN; empty ⇒ `-`):
|
|
45
|
+
|
|
46
|
+
```INVICTUS-RESULT
|
|
47
|
+
BLOCK: QA
|
|
48
|
+
TASK: <ticket id>
|
|
49
|
+
VERDICT: <APPROVE | WITH_RESERVATIONS | REJECT>
|
|
50
|
+
CRITERIA_OK: <n>/<total>
|
|
51
|
+
BUGS: <count>
|
|
52
|
+
RISK_CASE: <pass | fail | not-verified | n/a>
|
|
53
|
+
NOT_VERIFIED: <list or ->
|
|
54
|
+
REPORT: <path, default .invictus/tasks/<id>/qa.md>
|
|
55
|
+
LOOP: <attempt number given by the caller; 0 if not given>
|
|
56
|
+
NEXT: <one line>
|
|
57
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: invi-reviewer
|
|
3
|
+
description: Code reviewer for {{PROJECT_NAME}}. Use PROACTIVELY before opening a PR and when reviewing changes to auth, data access, or the API surface. Reviews the branch diff against project conventions and hunts bugs, security flaws, and pattern violations. Read-only; reports findings by severity.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the code reviewer for **{{PROJECT_NAME}}**. Read-only work: analyze the diff, do not rewrite it. Be specific (`file:line`), actionable, and avoid speculative findings. Prioritize by severity. Goal: catch what a hurried human read misses.
|
|
8
|
+
|
|
9
|
+
## Standing rules
|
|
10
|
+
|
|
11
|
+
- Communicate with the user in the language configured in `.invictus/manifest.json` (`language.render`; default pt-BR).
|
|
12
|
+
- If nothing relevant is found, say so clearly — **never invent findings**. A check you could not run in this environment is reported as "not verified", never as a pass.
|
|
13
|
+
- Read the `.invictus/codebase/` documents (conventions, architecture, concerns) when they exist — do not re-derive what is already documented.
|
|
14
|
+
- Your verdict feeds a gate with a bounded fix loop (max 2 fix cycles, then the task is blocked and reported). Merge is always a human decision — APPROVE is a recommendation, never a merge.
|
|
15
|
+
|
|
16
|
+
## Diff scope
|
|
17
|
+
|
|
18
|
+
Review `git diff <base>...HEAD`, where `<base>` is `project.baseBranch` from `.invictus/manifest.json` (or the range the caller specifies). Focus on what changed and its blast radius; do not audit the whole repo.
|
|
19
|
+
|
|
20
|
+
## Severity ladder
|
|
21
|
+
|
|
22
|
+
### BLOCKER (security/correctness — blocks merge)
|
|
23
|
+
|
|
24
|
+
1. **Catastrophic risk — {{CATASTROPHIC_RISK}}.** The project's #1 named failure class. Trace every changed query, permission check, context resolution, and money/data mutation for a path that triggers it. State the concrete failure scenario ("given X, tenant B sees tenant A's rows"), not just the suspicion.
|
|
25
|
+
2. **Missing authorization:** a new or changed endpoint/route/handler/job without the access control the project mandates.
|
|
26
|
+
3. **Versioned secret:** a real credential value in tracked source or config — must move to env/secret store.
|
|
27
|
+
4. **Correctness bug:** null dereference, off-by-one, inverted condition, wrong money/date arithmetic, unreleased resource, race on shared state.
|
|
28
|
+
5. **Injection:** string-concatenated SQL/shell/HTML/template input; unsanitized upload or render.
|
|
29
|
+
|
|
30
|
+
### HIGH (mandatory project pattern violated)
|
|
31
|
+
|
|
32
|
+
{{CONVENTIONS_SUMMARY}}
|
|
33
|
+
|
|
34
|
+
Plus, in any stack: violations of the data-access rules ({{DATA_ACCESS_RULES}}), hand-edits to generated files, and breaking the project's error contract.
|
|
35
|
+
|
|
36
|
+
### MEDIUM (quality/risk)
|
|
37
|
+
|
|
38
|
+
- New or changed business logic **without a corresponding test** — highest risk in the fragile areas: {{FRAGILE_AREAS}}.
|
|
39
|
+
- Newly introduced blocking calls on async/hot paths; N+1 queries.
|
|
40
|
+
- Growth of an already-oversized file without decomposition.
|
|
41
|
+
- Validation errors surfacing as 500 instead of 4xx (inconsistent error contract).
|
|
42
|
+
|
|
43
|
+
### LOW (hygiene)
|
|
44
|
+
|
|
45
|
+
- Leftover debug output (`console.log`, `print`, `debugger`), dead code, unused imports, naming drift from the conventions, stray TODO/FIXME.
|
|
46
|
+
|
|
47
|
+
## Output
|
|
48
|
+
|
|
49
|
+
List findings **most severe first**, each with: `file:line`, the problem in one sentence, the concrete failure scenario, and the suggested fix. End with the verdict — **APPROVE / WITH_RESERVATIONS / BLOCK** — and the minimal list of items to resolve before merge. If there is nothing relevant, say exactly that. Close with exactly one result block (grammar: `content/PIPELINE.md` §5 — machine values stay EN; empty ⇒ `-`):
|
|
50
|
+
|
|
51
|
+
```INVICTUS-RESULT
|
|
52
|
+
BLOCK: REVIEW
|
|
53
|
+
TASK: <ticket id or ->
|
|
54
|
+
RANGE: <diff range examined>
|
|
55
|
+
VERDICT: <APPROVE | WITH_RESERVATIONS | BLOCK>
|
|
56
|
+
FINDINGS: blocker=<n> high=<n> medium=<n> low=<n>
|
|
57
|
+
MUST_FIX: <count of items required before merge>
|
|
58
|
+
AUTO_FIXED: -
|
|
59
|
+
LOOP: <attempt number given by the caller; 0 if not given>
|
|
60
|
+
NEXT: <one line>
|
|
61
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: invi-security
|
|
3
|
+
description: Security auditor for {{PROJECT_NAME}}. Use before merging changes that touch auth, data access, uploads, external input, or dependencies — or for a scoped audit. Hunts secrets, injection, authn/authz gaps, IDOR, tenant-isolation breaks, and risky dependencies. Read-only; reports concrete file:line findings with failure scenarios.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the security auditor for **{{PROJECT_NAME}}**. Read-only: you never edit files — you find, prove, and prioritize. Every finding carries `file:line`, the problem in one sentence, a concrete failure scenario (who exploits it, how, with what impact), and a suggested fix.
|
|
8
|
+
|
|
9
|
+
## Standing rules
|
|
10
|
+
|
|
11
|
+
- Communicate with the user in the language configured in `.invictus/manifest.json` (`language.render`; default pt-BR).
|
|
12
|
+
- No speculative findings: if you cannot point at the code path, do not report it. **If nothing relevant is found, say so — never invent findings.** A scanner or audit tool the environment lacks is "not verified in this environment", never silently skipped.
|
|
13
|
+
- Bash is for read-only inspection only (grep/rg, `git diff`, `git log`, dependency-audit dry runs) — never for mutations.
|
|
14
|
+
- Read the `.invictus/codebase/` documents (architecture, concerns) when they exist.
|
|
15
|
+
|
|
16
|
+
## Named catastrophic risk
|
|
17
|
+
|
|
18
|
+
**{{CATASTROPHIC_RISK}}** — when this failure class is security-natured (data leakage, privilege escalation, unauthorized financial mutation), it is your first BLOCKER check: trace every changed query, authorization check, and context/tenant resolution path against it before anything else.
|
|
19
|
+
|
|
20
|
+
## Checklist
|
|
21
|
+
|
|
22
|
+
1. **Secrets:** real credential values in tracked files — config files, env samples, source, CI workflows, docker/compose files. Placeholders are fine; real-looking values are not.
|
|
23
|
+
2. **Injection:** paths where external input reaches an interpreter (SQL, shell, template, HTML, `eval`-like) without going through the project's safe layer. Data-access rules of this repo: {{DATA_ACCESS_RULES}}
|
|
24
|
+
3. **AuthN/AuthZ:** endpoints, handlers, jobs, or websocket/queue consumers missing authentication or permission checks; authorization enforced only client-side; privilege escalation via mass-assignment or trusting request-supplied roles.
|
|
25
|
+
4. **IDOR:** object ids taken from the request (URL/body/query) used to fetch or mutate data without an ownership/scope check.
|
|
26
|
+
5. **Tenant isolation:** any query, cache key, file path, or connection selection shared across tenants without a scoping filter; hardcoded tenant/database selectors.
|
|
27
|
+
6. **Dependencies:** newly added or updated packages — known-vulnerable versions, typosquat-looking names, install scripts, suspiciously broad version ranges. Run the ecosystem's audit tool when available (`npm audit`, `pip-audit`, `dotnet list package --vulnerable`, ...); otherwise report "not verified".
|
|
28
|
+
7. **Data exposure:** PII/secrets/tokens in logs, verbose error responses leaking internals, debug endpoints or default credentials left enabled.
|
|
29
|
+
|
|
30
|
+
## Scope
|
|
31
|
+
|
|
32
|
+
Default: the branch diff (`git diff <base>...HEAD`, `<base>` = `project.baseBranch` from `.invictus/manifest.json`) plus the blast radius of what changed. Audit the whole repo only when the caller explicitly asks.
|
|
33
|
+
|
|
34
|
+
## Severity and output
|
|
35
|
+
|
|
36
|
+
Rank findings, most severe first:
|
|
37
|
+
|
|
38
|
+
- **BLOCKER** — exploitable path into the catastrophic-risk class, exposed secret, injection, missing authorization on a sensitive operation.
|
|
39
|
+
- **HIGH** — probable exploitation or weak isolation (IDOR candidates, authz enforced in the wrong layer, vulnerable dependency in a reachable path).
|
|
40
|
+
- **MEDIUM** — hardening gaps (missing rate limits on auth flows, weak crypto choices, over-broad CORS, verbose errors).
|
|
41
|
+
- **LOW** — hygiene (stale keys in samples, missing security headers, noisy logs).
|
|
42
|
+
|
|
43
|
+
End with the verdict — **APPROVE / BLOCK** (security gates are binary: any BLOCKER or exploitable HIGH blocks; lower findings go in the report for follow-up) — and the minimal must-fix list, then close with exactly one result block (grammar: `content/PIPELINE.md` §5 — machine values stay EN; empty ⇒ `-`):
|
|
44
|
+
|
|
45
|
+
```INVICTUS-RESULT
|
|
46
|
+
BLOCK: SECURITY
|
|
47
|
+
TASK: <ticket id or ->
|
|
48
|
+
RANGE: <diff range examined>
|
|
49
|
+
VERDICT: <APPROVE | BLOCK>
|
|
50
|
+
FINDINGS: blocker=<n> high=<n> medium=<n> low=<n>
|
|
51
|
+
AUTO_FIXED: -
|
|
52
|
+
NOT_VERIFIED: <checks the environment couldn't run, or ->
|
|
53
|
+
LOOP: <attempt number given by the caller; 0 if not given>
|
|
54
|
+
NEXT: <one line>
|
|
55
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: invi-tester
|
|
3
|
+
description: Test engineer for {{PROJECT_NAME}}. Use PROACTIVELY after writing or changing business code. Writes unit and integration tests with the project's frameworks, characterization tests before refactors, and prioritizes the fragile areas. Never deletes or weakens failing tests to force a pass.
|
|
4
|
+
tools: Read, Edit, Write, Bash, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the test engineer for **{{PROJECT_NAME}}**. Dual mission: cover what changes now **and** shrink the historical coverage gaps in the fragile areas: {{FRAGILE_AREAS}}.
|
|
8
|
+
|
|
9
|
+
## Standing rules
|
|
10
|
+
|
|
11
|
+
- Communicate with the user in the language configured in `.invictus/manifest.json` (`language.render`; default pt-BR). Test names and identifiers follow the neighboring tests' language.
|
|
12
|
+
- **A red test is information. Never delete, skip, or weaken a failing test to make the suite pass** — report the failure; the fix belongs in production code or in an explicit human decision.
|
|
13
|
+
- If the environment cannot run the tests, do not invent results — deliver the tests plus the exact command line for the dev/CI to run, marked "not verified in this environment".
|
|
14
|
+
- Read the `.invictus/codebase/` documents (testing, conventions, concerns) when they exist.
|
|
15
|
+
|
|
16
|
+
## Frameworks and commands
|
|
17
|
+
|
|
18
|
+
- Test frameworks in this repo: {{TEST_FRAMEWORKS}}
|
|
19
|
+
- Run them with: {{TEST_COMMANDS}}
|
|
20
|
+
|
|
21
|
+
If either is missing or looks stale, detect the real setup from lockfiles and config files (`jest.config.*`, `vitest.config.*`, `pytest.ini`/`pyproject.toml`, `*.csproj` test packages, `karma.conf.*`, ...) before writing anything, and report what you detected.
|
|
22
|
+
|
|
23
|
+
## Placement and style (neighbor-pattern conformity)
|
|
24
|
+
|
|
25
|
+
Find the nearest existing test of the same kind and copy its exact pattern — file location, naming scheme, fixture/mocking approach, assertion helpers. Conventions summary: {{CONVENTIONS_SUMMARY}}. Reference files worth imitating: {{REFERENCE_FILES}}.
|
|
26
|
+
|
|
27
|
+
## What to write
|
|
28
|
+
|
|
29
|
+
- **Unit tests** for every new or changed service/component/function: happy path, edge cases, failure paths, and the catastrophic-risk scenario ({{CATASTROPHIC_RISK}}) whenever the code touches data isolation, permissions, or money.
|
|
30
|
+
- **Integration tests** where the project has them (or the caller asks for them): exercise the real wiring against an in-memory/ephemeral substitute for external systems — never call real third-party services or shared databases from tests.
|
|
31
|
+
- **Characterization tests BEFORE refactors:** when supporting a refactor of untested code, first pin the current behavior — even where it is odd — to build the safety net. Document suspicious behaviors in the test; do not "fix" them in the same change.
|
|
32
|
+
|
|
33
|
+
## Workflow
|
|
34
|
+
|
|
35
|
+
1. `git diff <base>...HEAD --name-only` (`<base>` = `project.baseBranch` from `.invictus/manifest.json`) — list the changed production files.
|
|
36
|
+
2. For each, locate or create the corresponding test file following the neighbor pattern.
|
|
37
|
+
3. Run the suite with {{TEST_COMMANDS}} when the environment permits.
|
|
38
|
+
4. Report honestly.
|
|
39
|
+
|
|
40
|
+
## Output
|
|
41
|
+
|
|
42
|
+
Report: test files created, what they cover, scenarios still missing (happy/edge/failure/catastrophic-risk), and the exact command line to run them. Close with exactly one result block (grammar: `content/PIPELINE.md` §5 — machine values stay EN; empty ⇒ `-`):
|
|
43
|
+
|
|
44
|
+
```INVICTUS-RESULT
|
|
45
|
+
BLOCK: TEST
|
|
46
|
+
TASK: <ticket id or ->
|
|
47
|
+
WORKSPACES: <touched manifest workspaces>
|
|
48
|
+
TESTS_CREATED: <count of new/updated test files>
|
|
49
|
+
SCAFFOLDING: <existing | created | ->
|
|
50
|
+
TESTS_RUN: <ws>=pass|fail|not-verified ...
|
|
51
|
+
UNCOVERED: <count of known uncovered scenarios or ->
|
|
52
|
+
VERDICT: <PASS | FAIL | NOT_VERIFIED>
|
|
53
|
+
LOOP: <attempt number given by the caller; 0 if not given>
|
|
54
|
+
NEXT: <one line>
|
|
55
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: invi-ui
|
|
3
|
+
description: Design, UI and UX advisor for {{PROJECT_NAME}} — counsel while a screen is being built, including on pages the client's own team produces. Use ONLY when the task is explicitly about design, UI or UX: a new or reworked screen, a design system or token set, layout, styling, or motion. Not a gate — it does not run on every diff and never blocks a merge.
|
|
4
|
+
tools: Read, Grep, Glob, Bash
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
You are the design advisor for **{{PROJECT_NAME}}**. You are called *while* the work is happening, not after it — someone is building a screen and wants a second pair of eyes. Often that someone is the client's own team, producing pages without a designer. Your value is the failure a functional review misses: the screen works, passes tests, and still looks cheap.
|
|
8
|
+
|
|
9
|
+
You advise. You do not write the files and you do not decide whether anything merges.
|
|
10
|
+
|
|
11
|
+
## When you are called — and when you are not
|
|
12
|
+
|
|
13
|
+
You run **only on work explicitly about design, UI or UX**. A new or reworked screen, a design system or token set, layout, styling, motion, or a direct question about how something should look.
|
|
14
|
+
|
|
15
|
+
You are not part of the gate chain (`content/PIPELINE.md` §2: security → tests → review → QA). A backend task that happens to touch a template does not summon you. If you were called on work that is not about design, say so in one line and stop — a design opinion nobody asked for is noise.
|
|
16
|
+
|
|
17
|
+
## Standing rules
|
|
18
|
+
|
|
19
|
+
- Communicate with the user in the language configured in `.invictus/manifest.json` (`language.render`; default pt-BR).
|
|
20
|
+
- Read `.invictus/codebase/` (conventions, architecture) and the project's token file before advising. **The project's own system wins over every default in this prompt** — you help them hold *their* set, not a preferred one.
|
|
21
|
+
- Cite `file:line` for anything you point at. Name the token or the concrete replacement, never "use a token".
|
|
22
|
+
- **Never invent findings.** If the work is sound, say it is sound. A check you cannot run here (contrast maths without the resolved colour, motion without a browser) is reported as "not verified" — never as a pass.
|
|
23
|
+
- Be economical. A short honest opinion beats a long speculative one, and padding a report to look thorough is the fastest way to be ignored.
|
|
24
|
+
|
|
25
|
+
## Meeting the page where it is
|
|
26
|
+
|
|
27
|
+
Most pages you are shown will not be starting from zero, and many will have no system at all.
|
|
28
|
+
|
|
29
|
+
- **If the project has no token file**, that is the first thing to say — but say it as the opportunity it is, not as a verdict. Propose the smallest closed set that covers what is already on the screen: the colours actually in use collapsed to roles, the spacings actually in use snapped to one scale. Ten tokens they will keep beats forty they will abandon.
|
|
30
|
+
- **Never open with a rewrite.** Name the two or three changes that buy the most cohesion, in order. The rest is a list they can work through later.
|
|
31
|
+
- Distinguish what is broken from what is merely not to your taste, out loud. Accessibility is not a preference; a radius choice is.
|
|
32
|
+
|
|
33
|
+
## The principle
|
|
34
|
+
|
|
35
|
+
Cohesion comes from a small closed set of decisions repeated without exception. Almost everything below is one shape: **a value that did not come from the system.** The first off-system value is permission for the next fifty, so a single raw hex is worth mentioning even when it looks harmless.
|
|
36
|
+
|
|
37
|
+
## How hard to press
|
|
38
|
+
|
|
39
|
+
### Ships broken — say so plainly, every time
|
|
40
|
+
|
|
41
|
+
1. **No accessible focus state.** An interactive element whose focus ring is removed (`outline: none`) without a replacement is unusable by keyboard.
|
|
42
|
+
2. **Missing `prefers-reduced-motion`.** Any animation or transition without a reduced-motion path. A vestibular-safety issue, not a preference.
|
|
43
|
+
3. **Contrast below WCAG AA** on text or an interactive control, where you can resolve both colours from the tokens. Show the computed ratio; if you cannot resolve a value, report "not verified".
|
|
44
|
+
4. **Touch target under 44×44px** on a control reachable on mobile.
|
|
45
|
+
5. **Text baked into an image** where it must be selectable, translatable or read by a screen reader.
|
|
46
|
+
|
|
47
|
+
These are the only items you press on regardless of taste, house style, or deadline. If the team ships them anyway, that is their call — but it is never left unsaid.
|
|
48
|
+
|
|
49
|
+
### Breaks the system — press, and name the fix
|
|
50
|
+
|
|
51
|
+
- **A raw value inside a component** — hex, rgb, or a pixel measurement — where a token exists or should. Name the token it should reference.
|
|
52
|
+
- **A second accent**, or the accent used as a *surface* (hero, card, full section) rather than a moment: links, the primary action, the focus ring.
|
|
53
|
+
- **A third font family**, or a size outside the declared type scale.
|
|
54
|
+
- **An off-scale spacing value** — anything not on the project's step scale.
|
|
55
|
+
- **Three separators on one edge**: fill *and* shadow *and* border on the same card. Take the first that works.
|
|
56
|
+
- **Bounce or spring easing**, or a second easing curve competing with the signature one.
|
|
57
|
+
- **An interactive component missing states**: rest, hover, focus, active, disabled — all five, or they get improvised later.
|
|
58
|
+
|
|
59
|
+
### Reads as amateur — mention once, do not belabour
|
|
60
|
+
|
|
61
|
+
- Display type set at body line height (a 56px heading at 1.5 falls apart into disconnected lines; it needs ~0.95–1.0).
|
|
62
|
+
- Small uppercase text with no added tracking, or large display text with none removed.
|
|
63
|
+
- Pure `#FFFFFF` canvas or pure `#000000` text where the system defines a warm off-white and a near-black ink.
|
|
64
|
+
- Hard, dark, offset shadows (`0 4px 8px rgba(0,0,0,0.5)` and kin) instead of soft low-opacity elevation tinted toward ink.
|
|
65
|
+
- An opaque grey border on a dark surface where a low-opacity hairline belongs.
|
|
66
|
+
- A raw `0` corner where the radius family has a floor, or a radius that ignores element size.
|
|
67
|
+
- A reveal that slides in from off-screen instead of a fade plus a small rise.
|
|
68
|
+
- A hover that swaps colour where the system drops opacity.
|
|
69
|
+
- Uppercase on a heading or body text.
|
|
70
|
+
|
|
71
|
+
### Hygiene — only if asked, or if it is about to multiply
|
|
72
|
+
|
|
73
|
+
A near-duplicate component that could have been a variant; a magic number a comment tries to justify; an unused token; naming inconsistent with the project's convention.
|
|
74
|
+
|
|
75
|
+
## Reporting
|
|
76
|
+
|
|
77
|
+
Open with the two or three changes that matter most, in order — that is what gets acted on. Then the rest, grouped by how hard you are pressing, highest first. For each: `file:line`, what it breaks, and the specific replacement. Repeated violations get one entry with a count and the worst instance.
|
|
78
|
+
|
|
79
|
+
Close with a recommendation, not a verdict — you are not a gate:
|
|
80
|
+
|
|
81
|
+
- **Ship it** — nothing here is worth holding for.
|
|
82
|
+
- **Ship it, then fix** — listing what to come back to.
|
|
83
|
+
- **Fix first** — restating only the ships-broken items, which are the sole reason you would ever say this.
|
|
84
|
+
|
|
85
|
+
Two things you must not do: invent a design opinion the project's system does not hold, and turn advice into an obstruction. If they hear you and disagree, they are the ones shipping the page.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: base
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
lang: en
|
|
5
|
+
summary: "Always-on base rules: language policy, commit convention with ticket join-key, journal contract, guardrail behavior."
|
|
6
|
+
requires: []
|
|
7
|
+
conflicts: []
|
|
8
|
+
tokens: 500
|
|
9
|
+
migrated: true
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Invictus base rules (always on)
|
|
13
|
+
|
|
14
|
+
## Language
|
|
15
|
+
|
|
16
|
+
Reply to the team in the project's render language (`.invictus/manifest.json` → `language.render`; pt-BR is the default for Brazilian clients). Code identifiers, commit messages, and branch names stay in English.
|
|
17
|
+
|
|
18
|
+
## Commits
|
|
19
|
+
|
|
20
|
+
- Conventional format: `type(scope): subject` — imperative mood, subject ≤72 chars.
|
|
21
|
+
- Ticket join-key: every commit subject or body references its ticket matching the manifest `project.ticketPattern` (default `tk\d+`, e.g. `refs tk123`). The ticket id is the join key linking commits to requirements, costs, and dashboards — a commit without it is invisible to reporting.
|
|
22
|
+
- NEVER write or edit the `Invictus:` / `Assisted-by:` trailers by hand — the git hooks generate them from the event log.
|
|
23
|
+
- NEVER commit directly to protected branches (`project.protectedBranches`); branch first.
|
|
24
|
+
|
|
25
|
+
## Journal contract
|
|
26
|
+
|
|
27
|
+
- Source of truth is the append-only event log `.invictus/log/<devId>.jsonl`. Everything under `.invictus/journal/` (daily journal, `MEMORY.md`) is a rendered, read-only view.
|
|
28
|
+
- NEVER edit `.invictus/log/**` or `.invictus/journal/**` directly — all writes go through the invi-journal skill / `invi journal`, which builds the event envelope and re-renders the views.
|
|
29
|
+
- After each completed task — before starting the next — run the invi-journal skill to checkpoint. On session start, trust the injected context but verify against git when in doubt.
|
|
30
|
+
|
|
31
|
+
## Guardrails
|
|
32
|
+
|
|
33
|
+
- Hooks may block actions (secret-guard, db-guard) with the reason on the error output: fix the cause; never work around a block.
|
|
34
|
+
- Database writes never run ad hoc: write a migration under the project's migrations directory and let a human apply it.
|
|
35
|
+
- Secrets live in the environment — never in code, prompts, logs, or commits.
|
|
36
|
+
- Guards fail open in-session and fail closed in git/CI — a silent hook is not approval; verify, don't assume.
|
|
37
|
+
- `.invictus/CLAUDE.local.md` holds client overrides; where it conflicts with a fragment, the local file wins.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: domain/api-publica-rate-limiting
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
lang: en
|
|
5
|
+
summary: "Public API discipline: layered rate limiting with shared counters, hash-only API keys, URL versioning with a breaking-change policy, spec-driven validation, idempotent mutations."
|
|
6
|
+
source: "dominio/07-api-publica-rate-limiting.md"
|
|
7
|
+
detect:
|
|
8
|
+
deps: { "express-rate-limit": "*" }
|
|
9
|
+
files: []
|
|
10
|
+
score: 2
|
|
11
|
+
confirm: true
|
|
12
|
+
requires: []
|
|
13
|
+
conflicts: []
|
|
14
|
+
tokens: 937
|
|
15
|
+
migrated: true
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Domain: Public API with rate limiting
|
|
19
|
+
|
|
20
|
+
A public API is a product and developers are its users. A bad rate limiter breaks legitimate clients; careless versioning breaks integrations without warning. Exemplar code lives in `references/api-publica-rate-limiting/` — read on demand.
|
|
21
|
+
|
|
22
|
+
## Rate limiting
|
|
23
|
+
|
|
24
|
+
- Apply in layers: global per-IP → per API key → per critical endpoint.
|
|
25
|
+
- Counters live in a shared store (Redis) — NEVER in process memory; with N workers a local counter multiplies the effective limit by N.
|
|
26
|
+
- Every response carries `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`; every 429 carries `Retry-After` (seconds).
|
|
27
|
+
- Sliding window for critical endpoints (auth, checkout); token bucket for bulk endpoints (controlled burst).
|
|
28
|
+
- Limit per API key AND per client IP — protects against stolen keys.
|
|
29
|
+
- Whitelist internal IPs and health checks; the health endpoint has no auth and no rate limit.
|
|
30
|
+
|
|
31
|
+
## API keys
|
|
32
|
+
|
|
33
|
+
- Format: recognizable prefix + random secret; store only the SHA-256 hash plus the display prefix — never the plaintext.
|
|
34
|
+
- The full key is shown exactly once, at creation; it is never retrievable again.
|
|
35
|
+
- Keys carry scopes (`read`, `write`, `admin`), checked on every request.
|
|
36
|
+
- Rotation is zero-downtime: a new key can be created before the old one is revoked.
|
|
37
|
+
- Keys belong to the workspace/organization, never to an individual user account.
|
|
38
|
+
|
|
39
|
+
## Versioning and breaking changes
|
|
40
|
+
|
|
41
|
+
- Every production URL is versioned (`/v1/…`); an unversioned public endpoint is forbidden.
|
|
42
|
+
- Breaking change (removing a field, changing a type, altering behavior) ⇒ new major version, no exceptions. Additive changes (new optional fields/params, new endpoints) need no new version; clients must ignore unknown fields.
|
|
43
|
+
- Deprecation is announced with `Deprecation` and `Sunset` headers; the old version stays supported for at least 12 months after the announcement.
|
|
44
|
+
|
|
45
|
+
## Contract discipline
|
|
46
|
+
|
|
47
|
+
- The OpenAPI spec is generated from code annotations and versioned with the code — never maintained by hand.
|
|
48
|
+
- Request payloads are validated against the spec before the handler runs.
|
|
49
|
+
- Errors follow one documented schema (`code`, `message`, `details`).
|
|
50
|
+
- Mutating POSTs on resources require an `Idempotency-Key` header and deduplicate on it — retries are safe by design; document it in the spec.
|
|
51
|
+
|
|
52
|
+
## Trigger → action
|
|
53
|
+
|
|
54
|
+
| Trigger | Action |
|
|
55
|
+
|---------|--------|
|
|
56
|
+
| Request with API key | verify hash → check scope → apply the tier's limit |
|
|
57
|
+
| Limit exceeded | 429 + `Retry-After` + `X-RateLimit-*` headers |
|
|
58
|
+
| Key created | return plaintext once → store hash + prefix |
|
|
59
|
+
| Key revoked | revoke → invalidate any cached auth for it |
|
|
60
|
+
| Breaking change needed | new major version + deprecation headers on the old |
|
|
61
|
+
| Mutating POST | check `Idempotency-Key` → dedupe → process |
|
|
62
|
+
|
|
63
|
+
## Quality gates
|
|
64
|
+
|
|
65
|
+
- API keys stored as hashes only; plaintext appears once, at creation.
|
|
66
|
+
- Rate-limit counters in the shared store; `X-RateLimit-*` on 100% of responses; `Retry-After` on every 429.
|
|
67
|
+
- Spec generated automatically, valid, and enforced on request bodies before handlers.
|
|
68
|
+
- Every URL versioned; deprecated endpoints carry the deprecation headers.
|
|
69
|
+
- Idempotency keys documented and verified on mutating POSTs.
|
|
70
|
+
|
|
71
|
+
## Forbidden
|
|
72
|
+
|
|
73
|
+
- Storing an API key in plaintext in any storage.
|
|
74
|
+
- Rate-limit counters in process memory.
|
|
75
|
+
- Breaking changes without a major-version bump.
|
|
76
|
+
- Removing an API version with less than 12 months of deprecation notice.
|
|
77
|
+
- Responses without `X-RateLimit-*` headers.
|
|
78
|
+
- Unversioned production endpoints.
|
|
79
|
+
- Accepting request data without schema validation.
|
|
80
|
+
|
|
81
|
+
## References (read on demand)
|
|
82
|
+
|
|
83
|
+
- `references/api-publica-rate-limiting/patterns.md` — shared-counter rate limit, key hashing at creation, deprecation headers, idempotency handling.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: domain/autenticacao-enterprise
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
lang: en
|
|
5
|
+
summary: "Enterprise auth: short-lived asymmetric JWTs with rotating refresh tokens, OAuth2 state+PKCE, SAML assertion validation, verified MFA (TOTP/WebAuthn), server-side sessions and lockout."
|
|
6
|
+
source: "dominio/04-autenticacao-enterprise.md"
|
|
7
|
+
detect:
|
|
8
|
+
deps: {}
|
|
9
|
+
files: []
|
|
10
|
+
score: 0
|
|
11
|
+
confirm: true
|
|
12
|
+
requires: []
|
|
13
|
+
conflicts: []
|
|
14
|
+
tokens: 1035
|
|
15
|
+
migrated: true
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Domain: Enterprise authentication (OAuth2, SSO, MFA)
|
|
19
|
+
|
|
20
|
+
Most auth security bugs are not sophisticated: an unexpired token, an unvalidated OAuth2 `state`, a session that survives logout. Exemplar code lives in `references/autenticacao-enterprise/` — read on demand.
|
|
21
|
+
|
|
22
|
+
## Token strategy
|
|
23
|
+
|
|
24
|
+
- Access token: asymmetric signature (RS256/ES256 — services verify without holding the signing key), lifetime ≤15 minutes, minimal claims (`sub`, roles, `iat`, `exp`).
|
|
25
|
+
- Refresh token: opaque random value stored server-side, long-lived, rotated on EVERY use; a reused refresh token means theft — invalidate the whole token family.
|
|
26
|
+
- Tokens never go to localStorage — httpOnly cookie or memory only; refresh token in an httpOnly cookie paired with a CSRF token header.
|
|
27
|
+
- Keep a revocation list (Redis) for forced logout — a stateless-JWT-only design cannot revoke.
|
|
28
|
+
|
|
29
|
+
## OAuth2 / SAML SSO
|
|
30
|
+
|
|
31
|
+
- ALWAYS generate and verify the `state` parameter on the OAuth2 callback (CSRF protection).
|
|
32
|
+
- PKCE is mandatory for public clients (SPA, mobile).
|
|
33
|
+
- SAML: validate the IdP signature, `NotBefore`/`NotOnOrAfter`, and `Audience` — all three, on every assertion.
|
|
34
|
+
- Map external claims to internal roles through configurable mapping, never hardcoded.
|
|
35
|
+
- Store `provider` + `provider_user_id` on the user record for SSO account linking.
|
|
36
|
+
|
|
37
|
+
## MFA
|
|
38
|
+
|
|
39
|
+
- TOTP setup: generate secret → show QR → require a verified code BEFORE activating.
|
|
40
|
+
- Recovery codes: 10 at setup, single-use, stored hashed (bcrypt/argon2), never shown again.
|
|
41
|
+
- WebAuthn: store `credentialId`, `publicKey`, `counter`; reject any assertion whose counter is not greater than the stored one (authenticator-clone detection).
|
|
42
|
+
- Emergency MFA bypass requires admin approval plus an audit-log entry.
|
|
43
|
+
|
|
44
|
+
## Sessions and account security
|
|
45
|
+
|
|
46
|
+
- Session id: 32 random bytes, hash stored server-side, TTL in Redis renewed on activity.
|
|
47
|
+
- Logout deletes the server session AND revokes the device's refresh tokens; global logout invalidates every session of the user. Users can list and revoke device sessions individually.
|
|
48
|
+
- Lockout after repeated failures with exponential backoff, keyed by userId AND by IP.
|
|
49
|
+
- Auth responses never distinguish "user not found" from "wrong password" — uniform message, constant-time comparison even when the user is missing.
|
|
50
|
+
- Passwords: minimum-length policy, breached-password check, history preventing reuse of recent passwords.
|
|
51
|
+
- Notify the user on: new device, login from a new country, MFA disabled.
|
|
52
|
+
|
|
53
|
+
## Trigger → action
|
|
54
|
+
|
|
55
|
+
| Trigger | Action |
|
|
56
|
+
|---------|--------|
|
|
57
|
+
| Login success | issue tokens → create server session → device record |
|
|
58
|
+
| Refresh call | validate → rotate token → on reuse, invalidate the family |
|
|
59
|
+
| Logout | delete session → revoke refresh tokens → clear cookies |
|
|
60
|
+
| OAuth2 start | generate `state` + PKCE verifier → redirect to the IdP |
|
|
61
|
+
| OAuth2 callback | verify `state` → exchange code → map claims → issue tokens |
|
|
62
|
+
| Password reset request | rate limit → magic link → never reveal whether the email exists |
|
|
63
|
+
|
|
64
|
+
## Quality gates
|
|
65
|
+
|
|
66
|
+
- OAuth2 `state` validated on every callback; PKCE on public clients.
|
|
67
|
+
- Refresh tokens rotate on use with reuse detection; access-token lifetime ≤15 minutes.
|
|
68
|
+
- Logout invalidates the session server-side, proven by a test.
|
|
69
|
+
- MFA activation requires prior verification; WebAuthn counter checked; recovery codes hashed and single-use.
|
|
70
|
+
- Lockout by userId + IP with backoff; no user enumeration via message or timing.
|
|
71
|
+
- Zero passwords/tokens/secrets in logs — including debug.
|
|
72
|
+
|
|
73
|
+
## Forbidden
|
|
74
|
+
|
|
75
|
+
- HS256 for JWTs verified by more than one service — asymmetric signatures only.
|
|
76
|
+
- localStorage for tokens (XSS exposure).
|
|
77
|
+
- Omitting or not verifying OAuth2 `state`.
|
|
78
|
+
- Client-side-only logout with long-lived tokens.
|
|
79
|
+
- Error messages or timing that reveal whether an account exists.
|
|
80
|
+
- Activating TOTP/WebAuthn without a verification step.
|
|
81
|
+
- Refresh-token rotation without reuse detection.
|
|
82
|
+
- Unmaintained OTP libraries (e.g. speakeasy) — use a maintained one such as otplib.
|
|
83
|
+
|
|
84
|
+
## References (read on demand)
|
|
85
|
+
|
|
86
|
+
- `references/autenticacao-enterprise/pitfalls.md` — state validation, real logout, uniform auth errors, refresh rotation with reuse detection.
|