@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.
Files changed (466) hide show
  1. package/LICENSE +21 -0
  2. package/LICENSING.md +49 -0
  3. package/README.md +507 -0
  4. package/assets/settings-template.json +99 -0
  5. package/bin/invi.js +6 -0
  6. package/content-dist/LICENSE +95 -0
  7. package/content-dist/PIPELINE.md +823 -0
  8. package/content-dist/README.md +128 -0
  9. package/content-dist/agents/README.md +135 -0
  10. package/content-dist/agents/mapping.json +476 -0
  11. package/content-dist/agents/stacks/backend-django.md +66 -0
  12. package/content-dist/agents/stacks/backend-dotnet.md +72 -0
  13. package/content-dist/agents/stacks/backend-fastapi.md +66 -0
  14. package/content-dist/agents/stacks/backend-laravel.md +66 -0
  15. package/content-dist/agents/stacks/backend-node.md +66 -0
  16. package/content-dist/agents/stacks/backend-spring.md +66 -0
  17. package/content-dist/agents/stacks/desktop-delphi.md +73 -0
  18. package/content-dist/agents/stacks/frontend-angular.md +65 -0
  19. package/content-dist/agents/stacks/frontend-react.md +67 -0
  20. package/content-dist/agents/stacks/frontend-svelte.md +67 -0
  21. package/content-dist/agents/stacks/frontend-vue.md +66 -0
  22. package/content-dist/agents/stacks/mobile-flutter.md +68 -0
  23. package/content-dist/agents/stacks/wordpress.md +66 -0
  24. package/content-dist/agents/universal/invi-qa.md +57 -0
  25. package/content-dist/agents/universal/invi-reviewer.md +61 -0
  26. package/content-dist/agents/universal/invi-security.md +55 -0
  27. package/content-dist/agents/universal/invi-tester.md +55 -0
  28. package/content-dist/agents/universal/invi-ui.md +85 -0
  29. package/content-dist/fragments/base.md +37 -0
  30. package/content-dist/fragments/domain/api-publica-rate-limiting.md +83 -0
  31. package/content-dist/fragments/domain/autenticacao-enterprise.md +86 -0
  32. package/content-dist/fragments/domain/busca-elasticsearch.md +86 -0
  33. package/content-dist/fragments/domain/dashboard-admin-rbac.md +80 -0
  34. package/content-dist/fragments/domain/design-system.md +71 -0
  35. package/content-dist/fragments/domain/ecommerce-completo.md +86 -0
  36. package/content-dist/fragments/domain/filas-jobs.md +80 -0
  37. package/content-dist/fragments/domain/integracao-crm-erp.md +82 -0
  38. package/content-dist/fragments/domain/lgpd.md +84 -0
  39. package/content-dist/fragments/domain/multi-tenancy.md +79 -0
  40. package/content-dist/fragments/domain/notificacoes-multicanal.md +81 -0
  41. package/content-dist/fragments/domain/pagamentos-brasil.md +85 -0
  42. package/content-dist/fragments/domain/plataforma-conteudo.md +77 -0
  43. package/content-dist/fragments/domain/realtime-websockets.md +92 -0
  44. package/content-dist/fragments/domain/relatorios-analytics.md +80 -0
  45. package/content-dist/fragments/domain/saas-stripe-billing.md +79 -0
  46. package/content-dist/fragments/domain/sistema-pagamentos.md +81 -0
  47. package/content-dist/fragments/domain/upload-midia.md +81 -0
  48. package/content-dist/fragments/domain/whatsapp-business.md +82 -0
  49. package/content-dist/fragments/index.json +1670 -0
  50. package/content-dist/fragments/references/angular-ngrx/app-config-and-testing.md +81 -0
  51. package/content-dist/fragments/references/angular-ngrx/store-pattern.md +155 -0
  52. package/content-dist/fragments/references/ansible-server-setup/layout-and-config.md +143 -0
  53. package/content-dist/fragments/references/ansible-server-setup/roles.md +238 -0
  54. package/content-dist/fragments/references/api-publica-rate-limiting/patterns.md +68 -0
  55. package/content-dist/fragments/references/astro-static/content-and-islands.md +117 -0
  56. package/content-dist/fragments/references/autenticacao-enterprise/pitfalls.md +70 -0
  57. package/content-dist/fragments/references/busca-elasticsearch/patterns.md +100 -0
  58. package/content-dist/fragments/references/chrome-extension-mv3/messaging-and-storage.md +109 -0
  59. package/content-dist/fragments/references/cli-typescript-commander/commands-and-config.md +136 -0
  60. package/content-dist/fragments/references/cloud-run-gcp/build-and-deploy.md +127 -0
  61. package/content-dist/fragments/references/cloud-run-gcp/iam-secrets-networking.md +65 -0
  62. package/content-dist/fragments/references/computer-vision-yolo/serving-and-export.md +182 -0
  63. package/content-dist/fragments/references/computer-vision-yolo/training-and-validation.md +131 -0
  64. package/content-dist/fragments/references/convex-react/functions.md +117 -0
  65. package/content-dist/fragments/references/convex-react/react-and-storage.md +109 -0
  66. package/content-dist/fragments/references/dashboard-admin-rbac/patterns.md +73 -0
  67. package/content-dist/fragments/references/data-pipeline-airflow/dag-patterns.md +149 -0
  68. package/content-dist/fragments/references/data-pipeline-airflow/operations.md +74 -0
  69. package/content-dist/fragments/references/delphi-object-pascal/legacy-extraction.md +175 -0
  70. package/content-dist/fragments/references/django-drf-celery/celery-tasks.md +47 -0
  71. package/content-dist/fragments/references/django-drf-celery/viewsets-and-serializers.md +92 -0
  72. package/content-dist/fragments/references/docker-compose-dev/compose-files.md +146 -0
  73. package/content-dist/fragments/references/docker-compose-dev/dockerfile-and-proxy.md +108 -0
  74. package/content-dist/fragments/references/dotnet-aspnet/data-and-di.md +90 -0
  75. package/content-dist/fragments/references/dotnet-aspnet/web-layer.md +88 -0
  76. package/content-dist/fragments/references/ecommerce-completo/patterns.md +76 -0
  77. package/content-dist/fragments/references/electron-app/ipc-bridge.md +123 -0
  78. package/content-dist/fragments/references/electron-app/security-and-packaging.md +134 -0
  79. package/content-dist/fragments/references/elixir-phoenix/context-and-web.md +112 -0
  80. package/content-dist/fragments/references/elixir-phoenix/processes.md +65 -0
  81. package/content-dist/fragments/references/filas-jobs/patterns.md +116 -0
  82. package/content-dist/fragments/references/fine-tuning-huggingface/data-and-export.md +114 -0
  83. package/content-dist/fragments/references/fine-tuning-huggingface/training-and-lora.md +123 -0
  84. package/content-dist/fragments/references/flutter/platform-channels-and-goldens.md +68 -0
  85. package/content-dist/fragments/references/flutter/state-and-widgets.md +95 -0
  86. package/content-dist/fragments/references/github-actions-cicd/workflows.md +235 -0
  87. package/content-dist/fragments/references/go-chi-gorm/http-layer.md +87 -0
  88. package/content-dist/fragments/references/go-chi-gorm/service-layer.md +58 -0
  89. package/content-dist/fragments/references/graphql-apollo/resolvers-and-loaders.md +128 -0
  90. package/content-dist/fragments/references/hono-bun/patterns.md +144 -0
  91. package/content-dist/fragments/references/integracao-crm-erp/patterns.md +100 -0
  92. package/content-dist/fragments/references/kubernetes-helm/chart-templates.md +162 -0
  93. package/content-dist/fragments/references/kubernetes-helm/secrets-storage-deploy.md +78 -0
  94. package/content-dist/fragments/references/langchain-python-agent/agent-and-cost.md +120 -0
  95. package/content-dist/fragments/references/langchain-python-agent/memory-and-resilience.md +76 -0
  96. package/content-dist/fragments/references/laravel/eloquent-and-queues.md +126 -0
  97. package/content-dist/fragments/references/laravel/http-layer.md +110 -0
  98. package/content-dist/fragments/references/lgpd/patterns.md +110 -0
  99. package/content-dist/fragments/references/llm-ops-production/routing-and-budget.md +118 -0
  100. package/content-dist/fragments/references/llm-ops-production/tracing-eval-ab.md +102 -0
  101. package/content-dist/fragments/references/microservices-docker/compose-and-gateway.md +93 -0
  102. package/content-dist/fragments/references/microservices-docker/events-and-correlation.md +88 -0
  103. package/content-dist/fragments/references/ml-fastapi-serving/metrics-drift-docker.md +97 -0
  104. package/content-dist/fragments/references/ml-fastapi-serving/serving-core.md +155 -0
  105. package/content-dist/fragments/references/ml-training-pipeline/dvc-pipeline.md +102 -0
  106. package/content-dist/fragments/references/ml-training-pipeline/mlflow-registry-ci.md +139 -0
  107. package/content-dist/fragments/references/monitoring-observability/alerts-and-config.md +169 -0
  108. package/content-dist/fragments/references/monitoring-observability/instrumentation-node.md +139 -0
  109. package/content-dist/fragments/references/multi-tenancy/patterns.md +85 -0
  110. package/content-dist/fragments/references/nestjs-typescript/guards-and-decorators.md +103 -0
  111. package/content-dist/fragments/references/nestjs-typescript/modules-dtos-setup.md +106 -0
  112. package/content-dist/fragments/references/nextjs-app-router/patterns.md +177 -0
  113. package/content-dist/fragments/references/nextjs-prisma-postgres/billing.md +167 -0
  114. package/content-dist/fragments/references/nextjs-trpc-drizzle/data-and-auth.md +121 -0
  115. package/content-dist/fragments/references/nextjs-trpc-drizzle/trpc-setup.md +62 -0
  116. package/content-dist/fragments/references/nodejs-express-typescript/config-and-tokens.md +48 -0
  117. package/content-dist/fragments/references/nodejs-express-typescript/middleware.md +108 -0
  118. package/content-dist/fragments/references/notificacoes-multicanal/patterns.md +78 -0
  119. package/content-dist/fragments/references/nuxt3-tailwind/server-routes.md +79 -0
  120. package/content-dist/fragments/references/nuxt3-tailwind/state-and-fetching.md +129 -0
  121. package/content-dist/fragments/references/openai-api-integration/calls.md +210 -0
  122. package/content-dist/fragments/references/openai-api-integration/client-and-cost.md +71 -0
  123. package/content-dist/fragments/references/pagamentos-brasil/gateways-reconciliation.md +92 -0
  124. package/content-dist/fragments/references/pagamentos-brasil/pix-boleto.md +115 -0
  125. package/content-dist/fragments/references/plataforma-conteudo/patterns.md +74 -0
  126. package/content-dist/fragments/references/python-fastapi/dependency-injection.md +99 -0
  127. package/content-dist/fragments/references/python-fastapi/settings-and-tasks.md +47 -0
  128. package/content-dist/fragments/references/rag-pipeline/ingestion.md +92 -0
  129. package/content-dist/fragments/references/rag-pipeline/retrieval-and-eval.md +148 -0
  130. package/content-dist/fragments/references/react-express-monolith/auth-and-client.md +110 -0
  131. package/content-dist/fragments/references/react-express-monolith/monorepo.md +71 -0
  132. package/content-dist/fragments/references/react-native-expo/native-patterns.md +103 -0
  133. package/content-dist/fragments/references/react-native-expo/navigation-and-auth.md +55 -0
  134. package/content-dist/fragments/references/react-ts-zustand-query/store-and-query.md +152 -0
  135. package/content-dist/fragments/references/react-typescript/feature-module.md +64 -0
  136. package/content-dist/fragments/references/react-typescript/forms-and-state.md +69 -0
  137. package/content-dist/fragments/references/react-typescript/recipes.md +37 -0
  138. package/content-dist/fragments/references/react-typescript/testing.md +40 -0
  139. package/content-dist/fragments/references/realtime-websockets/patterns.md +92 -0
  140. package/content-dist/fragments/references/relatorios-analytics/patterns.md +81 -0
  141. package/content-dist/fragments/references/remix-express-full/auth-and-uploads.md +88 -0
  142. package/content-dist/fragments/references/remix-express-full/express-server.md +54 -0
  143. package/content-dist/fragments/references/remix-typescript/auth-and-db.md +68 -0
  144. package/content-dist/fragments/references/remix-typescript/loaders-and-actions.md +98 -0
  145. package/content-dist/fragments/references/rust-axum/error-and-state.md +99 -0
  146. package/content-dist/fragments/references/rust-axum/handlers.md +87 -0
  147. package/content-dist/fragments/references/saas-stripe-billing/patterns.md +86 -0
  148. package/content-dist/fragments/references/serverless-lambda/handler-patterns.md +107 -0
  149. package/content-dist/fragments/references/sistema-pagamentos/pitfalls.md +54 -0
  150. package/content-dist/fragments/references/spring-boot/service-and-data.md +96 -0
  151. package/content-dist/fragments/references/spring-boot/web-layer.md +100 -0
  152. package/content-dist/fragments/references/supabase-nextjs/clients-and-middleware.md +102 -0
  153. package/content-dist/fragments/references/supabase-nextjs/rls-and-storage.md +86 -0
  154. package/content-dist/fragments/references/svelte-sveltekit/hooks-and-state.md +67 -0
  155. package/content-dist/fragments/references/svelte-sveltekit/load-and-actions.md +80 -0
  156. package/content-dist/fragments/references/t3-stack/routers-and-callers.md +75 -0
  157. package/content-dist/fragments/references/t3-stack/trpc-setup.md +60 -0
  158. package/content-dist/fragments/references/terraform-aws/modules-and-ci.md +114 -0
  159. package/content-dist/fragments/references/terraform-aws/state-and-workspaces.md +66 -0
  160. package/content-dist/fragments/references/turborepo-monorepo/pipeline-and-packages.md +84 -0
  161. package/content-dist/fragments/references/upload-midia/patterns.md +80 -0
  162. package/content-dist/fragments/references/vector-search-pinecone/client-and-upsert.md +98 -0
  163. package/content-dist/fragments/references/vector-search-pinecone/query-and-hybrid.md +81 -0
  164. package/content-dist/fragments/references/vps-deploy-producao/compose-prod.md +97 -0
  165. package/content-dist/fragments/references/vps-deploy-producao/proxy-and-operations.md +118 -0
  166. package/content-dist/fragments/references/vscode-extension/activation-and-tree.md +98 -0
  167. package/content-dist/fragments/references/vscode-extension/webview-csp.md +57 -0
  168. package/content-dist/fragments/references/vue3-pinia-vite/components-and-stores.md +73 -0
  169. package/content-dist/fragments/references/vue3-pinia-vite/queries-forms-testing.md +100 -0
  170. package/content-dist/fragments/references/whatsapp-business/patterns.md +107 -0
  171. package/content-dist/fragments/references/wordpress/hooks-and-security.md +92 -0
  172. package/content-dist/fragments/references/wordpress/wp-cli-gates.md +64 -0
  173. package/content-dist/fragments/stack/angular-ngrx.md +75 -0
  174. package/content-dist/fragments/stack/ansible-server-setup.md +69 -0
  175. package/content-dist/fragments/stack/astro-static.md +72 -0
  176. package/content-dist/fragments/stack/chrome-extension-mv3.md +66 -0
  177. package/content-dist/fragments/stack/cli-typescript-commander.md +66 -0
  178. package/content-dist/fragments/stack/cloud-run-gcp.md +63 -0
  179. package/content-dist/fragments/stack/computer-vision-yolo.md +62 -0
  180. package/content-dist/fragments/stack/convex-react.md +65 -0
  181. package/content-dist/fragments/stack/data-pipeline-airflow.md +64 -0
  182. package/content-dist/fragments/stack/delphi-object-pascal.md +63 -0
  183. package/content-dist/fragments/stack/django-drf-celery.md +63 -0
  184. package/content-dist/fragments/stack/docker-compose-dev.md +69 -0
  185. package/content-dist/fragments/stack/dotnet-aspnet.md +62 -0
  186. package/content-dist/fragments/stack/electron-app.md +70 -0
  187. package/content-dist/fragments/stack/elixir-phoenix.md +65 -0
  188. package/content-dist/fragments/stack/fine-tuning-huggingface.md +69 -0
  189. package/content-dist/fragments/stack/flutter.md +61 -0
  190. package/content-dist/fragments/stack/github-actions-cicd.md +73 -0
  191. package/content-dist/fragments/stack/go-chi-gorm.md +73 -0
  192. package/content-dist/fragments/stack/graphql-apollo.md +70 -0
  193. package/content-dist/fragments/stack/hono-bun.md +62 -0
  194. package/content-dist/fragments/stack/kubernetes-helm.md +67 -0
  195. package/content-dist/fragments/stack/langchain-python-agent.md +64 -0
  196. package/content-dist/fragments/stack/laravel.md +64 -0
  197. package/content-dist/fragments/stack/llm-ops-production.md +63 -0
  198. package/content-dist/fragments/stack/microservices-docker.md +70 -0
  199. package/content-dist/fragments/stack/ml-fastapi-serving.md +64 -0
  200. package/content-dist/fragments/stack/ml-training-pipeline.md +67 -0
  201. package/content-dist/fragments/stack/monitoring-observability.md +68 -0
  202. package/content-dist/fragments/stack/nestjs-typescript.md +68 -0
  203. package/content-dist/fragments/stack/nextjs-app-router.md +65 -0
  204. package/content-dist/fragments/stack/nextjs-prisma-postgres.md +61 -0
  205. package/content-dist/fragments/stack/nextjs-trpc-drizzle.md +63 -0
  206. package/content-dist/fragments/stack/nodejs-express-typescript.md +60 -0
  207. package/content-dist/fragments/stack/nuxt3-tailwind.md +62 -0
  208. package/content-dist/fragments/stack/openai-api-integration.md +58 -0
  209. package/content-dist/fragments/stack/python-fastapi.md +64 -0
  210. package/content-dist/fragments/stack/rag-pipeline.md +62 -0
  211. package/content-dist/fragments/stack/react-express-monolith.md +61 -0
  212. package/content-dist/fragments/stack/react-native-expo.md +68 -0
  213. package/content-dist/fragments/stack/react-ts-zustand-query.md +64 -0
  214. package/content-dist/fragments/stack/react-typescript.md +73 -0
  215. package/content-dist/fragments/stack/remix-express-full.md +63 -0
  216. package/content-dist/fragments/stack/remix-typescript.md +66 -0
  217. package/content-dist/fragments/stack/rust-axum.md +63 -0
  218. package/content-dist/fragments/stack/serverless-lambda.md +65 -0
  219. package/content-dist/fragments/stack/spring-boot.md +63 -0
  220. package/content-dist/fragments/stack/supabase-nextjs.md +64 -0
  221. package/content-dist/fragments/stack/svelte-sveltekit.md +67 -0
  222. package/content-dist/fragments/stack/t3-stack.md +63 -0
  223. package/content-dist/fragments/stack/terraform-aws.md +65 -0
  224. package/content-dist/fragments/stack/turborepo-monorepo.md +61 -0
  225. package/content-dist/fragments/stack/vector-search-pinecone.md +63 -0
  226. package/content-dist/fragments/stack/vps-deploy-producao.md +64 -0
  227. package/content-dist/fragments/stack/vscode-extension.md +64 -0
  228. package/content-dist/fragments/stack/vue3-pinia-vite.md +65 -0
  229. package/content-dist/fragments/stack/wordpress.md +63 -0
  230. package/content-dist/skills/invi-commit/SKILL.md +85 -0
  231. package/content-dist/skills/invi-journal/SKILL.md +67 -0
  232. package/content-dist/skills/invi-map/SKILL.md +118 -0
  233. package/content-dist/skills/invi-mode/SKILL.md +176 -0
  234. package/content-dist/skills/invi-pr/SKILL.md +142 -0
  235. package/content-dist/skills/invi-qa/SKILL.md +75 -0
  236. package/content-dist/skills/invi-refactor-legacy/SKILL.md +90 -0
  237. package/content-dist/skills/invi-review/SKILL.md +83 -0
  238. package/content-dist/skills/invi-security/SKILL.md +89 -0
  239. package/content-dist/skills/invi-status/SKILL.md +72 -0
  240. package/content-dist/skills/invi-task/SKILL.md +143 -0
  241. package/content-dist/skills/invi-test/SKILL.md +97 -0
  242. package/content-dist/skills/po-handoff/SKILL.md +130 -0
  243. package/content-dist/skills/po-intake/SKILL.md +115 -0
  244. package/content-dist/skills/po-lint/SKILL.md +82 -0
  245. package/content-dist/skills/po-spec/SKILL.md +138 -0
  246. package/content-dist/skills/po-status/SKILL.md +130 -0
  247. package/content-dist/skills/po-verify/SKILL.md +124 -0
  248. package/content-dist/templates/requirements/REQ-TEMPLATE.md +110 -0
  249. package/content-dist/templates/requirements/constitution-TEMPLATE.md +77 -0
  250. package/dist/baseline.d.ts +21 -0
  251. package/dist/baseline.d.ts.map +1 -0
  252. package/dist/baseline.js +43 -0
  253. package/dist/baseline.js.map +1 -0
  254. package/dist/cli.d.ts +15 -0
  255. package/dist/cli.d.ts.map +1 -0
  256. package/dist/cli.js +345 -0
  257. package/dist/cli.js.map +1 -0
  258. package/dist/commands/doctor.d.ts +31 -0
  259. package/dist/commands/doctor.d.ts.map +1 -0
  260. package/dist/commands/doctor.js +173 -0
  261. package/dist/commands/doctor.js.map +1 -0
  262. package/dist/commands/export.d.ts +49 -0
  263. package/dist/commands/export.d.ts.map +1 -0
  264. package/dist/commands/export.js +95 -0
  265. package/dist/commands/export.js.map +1 -0
  266. package/dist/commands/gate.d.ts +42 -0
  267. package/dist/commands/gate.d.ts.map +1 -0
  268. package/dist/commands/gate.js +97 -0
  269. package/dist/commands/gate.js.map +1 -0
  270. package/dist/commands/init.d.ts +88 -0
  271. package/dist/commands/init.d.ts.map +1 -0
  272. package/dist/commands/init.js +540 -0
  273. package/dist/commands/init.js.map +1 -0
  274. package/dist/commands/journalCmd.d.ts +47 -0
  275. package/dist/commands/journalCmd.d.ts.map +1 -0
  276. package/dist/commands/journalCmd.js +89 -0
  277. package/dist/commands/journalCmd.js.map +1 -0
  278. package/dist/commands/keys.d.ts +68 -0
  279. package/dist/commands/keys.d.ts.map +1 -0
  280. package/dist/commands/keys.js +240 -0
  281. package/dist/commands/keys.js.map +1 -0
  282. package/dist/commands/map.d.ts +123 -0
  283. package/dist/commands/map.d.ts.map +1 -0
  284. package/dist/commands/map.js +383 -0
  285. package/dist/commands/map.js.map +1 -0
  286. package/dist/commands/plan.d.ts +28 -0
  287. package/dist/commands/plan.d.ts.map +1 -0
  288. package/dist/commands/plan.js +64 -0
  289. package/dist/commands/plan.js.map +1 -0
  290. package/dist/commands/req.d.ts +92 -0
  291. package/dist/commands/req.d.ts.map +1 -0
  292. package/dist/commands/req.js +270 -0
  293. package/dist/commands/req.js.map +1 -0
  294. package/dist/commands/review.d.ts +40 -0
  295. package/dist/commands/review.d.ts.map +1 -0
  296. package/dist/commands/review.js +101 -0
  297. package/dist/commands/review.js.map +1 -0
  298. package/dist/commands/run.d.ts +33 -0
  299. package/dist/commands/run.d.ts.map +1 -0
  300. package/dist/commands/run.js +151 -0
  301. package/dist/commands/run.js.map +1 -0
  302. package/dist/commands/ship.d.ts +45 -0
  303. package/dist/commands/ship.d.ts.map +1 -0
  304. package/dist/commands/ship.js +252 -0
  305. package/dist/commands/ship.js.map +1 -0
  306. package/dist/commands/status.d.ts +36 -0
  307. package/dist/commands/status.d.ts.map +1 -0
  308. package/dist/commands/status.js +152 -0
  309. package/dist/commands/status.js.map +1 -0
  310. package/dist/commands/sync.d.ts +91 -0
  311. package/dist/commands/sync.d.ts.map +1 -0
  312. package/dist/commands/sync.js +331 -0
  313. package/dist/commands/sync.js.map +1 -0
  314. package/dist/commands/syncCommits.d.ts +56 -0
  315. package/dist/commands/syncCommits.d.ts.map +1 -0
  316. package/dist/commands/syncCommits.js +97 -0
  317. package/dist/commands/syncCommits.js.map +1 -0
  318. package/dist/commands/task.d.ts +108 -0
  319. package/dist/commands/task.d.ts.map +1 -0
  320. package/dist/commands/task.js +217 -0
  321. package/dist/commands/task.js.map +1 -0
  322. package/dist/commands/update.d.ts +92 -0
  323. package/dist/commands/update.d.ts.map +1 -0
  324. package/dist/commands/update.js +541 -0
  325. package/dist/commands/update.js.map +1 -0
  326. package/dist/commands/verifyTask.d.ts +50 -0
  327. package/dist/commands/verifyTask.d.ts.map +1 -0
  328. package/dist/commands/verifyTask.js +172 -0
  329. package/dist/commands/verifyTask.js.map +1 -0
  330. package/dist/content.d.ts +128 -0
  331. package/dist/content.d.ts.map +1 -0
  332. package/dist/content.js +177 -0
  333. package/dist/content.js.map +1 -0
  334. package/dist/detect.d.ts +122 -0
  335. package/dist/detect.d.ts.map +1 -0
  336. package/dist/detect.js +594 -0
  337. package/dist/detect.js.map +1 -0
  338. package/dist/events.d.ts +36 -0
  339. package/dist/events.d.ts.map +1 -0
  340. package/dist/events.js +76 -0
  341. package/dist/events.js.map +1 -0
  342. package/dist/frontmatter.d.ts +15 -0
  343. package/dist/frontmatter.d.ts.map +1 -0
  344. package/dist/frontmatter.js +74 -0
  345. package/dist/frontmatter.js.map +1 -0
  346. package/dist/i18n/en.d.ts +421 -0
  347. package/dist/i18n/en.d.ts.map +1 -0
  348. package/dist/i18n/en.js +443 -0
  349. package/dist/i18n/en.js.map +1 -0
  350. package/dist/i18n/index.d.ts +40 -0
  351. package/dist/i18n/index.d.ts.map +1 -0
  352. package/dist/i18n/index.js +66 -0
  353. package/dist/i18n/index.js.map +1 -0
  354. package/dist/i18n/pt-BR.d.ts +11 -0
  355. package/dist/i18n/pt-BR.d.ts.map +1 -0
  356. package/dist/i18n/pt-BR.js +435 -0
  357. package/dist/i18n/pt-BR.js.map +1 -0
  358. package/dist/identity.d.ts +78 -0
  359. package/dist/identity.d.ts.map +1 -0
  360. package/dist/identity.js +152 -0
  361. package/dist/identity.js.map +1 -0
  362. package/dist/index.d.ts +79 -0
  363. package/dist/index.d.ts.map +1 -0
  364. package/dist/index.js +48 -0
  365. package/dist/index.js.map +1 -0
  366. package/dist/insights.d.ts +86 -0
  367. package/dist/insights.d.ts.map +1 -0
  368. package/dist/insights.js +199 -0
  369. package/dist/insights.js.map +1 -0
  370. package/dist/interview.d.ts +81 -0
  371. package/dist/interview.d.ts.map +1 -0
  372. package/dist/interview.js +283 -0
  373. package/dist/interview.js.map +1 -0
  374. package/dist/inventory.d.ts +79 -0
  375. package/dist/inventory.d.ts.map +1 -0
  376. package/dist/inventory.js +86 -0
  377. package/dist/inventory.js.map +1 -0
  378. package/dist/journal.d.ts +22 -0
  379. package/dist/journal.d.ts.map +1 -0
  380. package/dist/journal.js +88 -0
  381. package/dist/journal.js.map +1 -0
  382. package/dist/migrations/legacyNames.d.ts +45 -0
  383. package/dist/migrations/legacyNames.d.ts.map +1 -0
  384. package/dist/migrations/legacyNames.js +118 -0
  385. package/dist/migrations/legacyNames.js.map +1 -0
  386. package/dist/plan.d.ts +42 -0
  387. package/dist/plan.d.ts.map +1 -0
  388. package/dist/plan.js +126 -0
  389. package/dist/plan.js.map +1 -0
  390. package/dist/render/agents.d.ts +327 -0
  391. package/dist/render/agents.d.ts.map +1 -0
  392. package/dist/render/agents.js +356 -0
  393. package/dist/render/agents.js.map +1 -0
  394. package/dist/render/claudeMd.d.ts +29 -0
  395. package/dist/render/claudeMd.d.ts.map +1 -0
  396. package/dist/render/claudeMd.js +110 -0
  397. package/dist/render/claudeMd.js.map +1 -0
  398. package/dist/render/githooks.d.ts +41 -0
  399. package/dist/render/githooks.d.ts.map +1 -0
  400. package/dist/render/githooks.js +168 -0
  401. package/dist/render/githooks.js.map +1 -0
  402. package/dist/render/markers.d.ts +13 -0
  403. package/dist/render/markers.d.ts.map +1 -0
  404. package/dist/render/markers.js +35 -0
  405. package/dist/render/markers.js.map +1 -0
  406. package/dist/render/requirements.d.ts +56 -0
  407. package/dist/render/requirements.d.ts.map +1 -0
  408. package/dist/render/requirements.js +86 -0
  409. package/dist/render/requirements.js.map +1 -0
  410. package/dist/render/settings.d.ts +43 -0
  411. package/dist/render/settings.d.ts.map +1 -0
  412. package/dist/render/settings.js +94 -0
  413. package/dist/render/settings.js.map +1 -0
  414. package/dist/render/transparency.d.ts +7 -0
  415. package/dist/render/transparency.d.ts.map +1 -0
  416. package/dist/render/transparency.js +164 -0
  417. package/dist/render/transparency.js.map +1 -0
  418. package/dist/requirements.d.ts +84 -0
  419. package/dist/requirements.d.ts.map +1 -0
  420. package/dist/requirements.js +229 -0
  421. package/dist/requirements.js.map +1 -0
  422. package/dist/sizing.d.ts +63 -0
  423. package/dist/sizing.d.ts.map +1 -0
  424. package/dist/sizing.js +104 -0
  425. package/dist/sizing.js.map +1 -0
  426. package/dist/tasks.d.ts +199 -0
  427. package/dist/tasks.d.ts.map +1 -0
  428. package/dist/tasks.js +320 -0
  429. package/dist/tasks.js.map +1 -0
  430. package/dist/util/diff3.d.ts +26 -0
  431. package/dist/util/diff3.d.ts.map +1 -0
  432. package/dist/util/diff3.js +112 -0
  433. package/dist/util/diff3.js.map +1 -0
  434. package/dist/util/fsx.d.ts +33 -0
  435. package/dist/util/fsx.d.ts.map +1 -0
  436. package/dist/util/fsx.js +153 -0
  437. package/dist/util/fsx.js.map +1 -0
  438. package/dist/util/git.d.ts +58 -0
  439. package/dist/util/git.d.ts.map +1 -0
  440. package/dist/util/git.js +171 -0
  441. package/dist/util/git.js.map +1 -0
  442. package/dist/util/merge.d.ts +27 -0
  443. package/dist/util/merge.d.ts.map +1 -0
  444. package/dist/util/merge.js +78 -0
  445. package/dist/util/merge.js.map +1 -0
  446. package/dist/util/out.d.ts +18 -0
  447. package/dist/util/out.d.ts.map +1 -0
  448. package/dist/util/out.js +23 -0
  449. package/dist/util/out.js.map +1 -0
  450. package/dist/util/proc.d.ts +12 -0
  451. package/dist/util/proc.d.ts.map +1 -0
  452. package/dist/util/proc.js +45 -0
  453. package/dist/util/proc.js.map +1 -0
  454. package/dist/util/registry.d.ts +58 -0
  455. package/dist/util/registry.d.ts.map +1 -0
  456. package/dist/util/registry.js +240 -0
  457. package/dist/util/registry.js.map +1 -0
  458. package/dist/verify.d.ts +52 -0
  459. package/dist/verify.d.ts.map +1 -0
  460. package/dist/verify.js +205 -0
  461. package/dist/verify.js.map +1 -0
  462. package/dist/version.d.ts +5 -0
  463. package/dist/version.d.ts.map +1 -0
  464. package/dist/version.js +18 -0
  465. package/dist/version.js.map +1 -0
  466. package/package.json +63 -0
@@ -0,0 +1,64 @@
1
+ ---
2
+ id: stack/ml-fastapi-serving
3
+ version: 1.0.0
4
+ lang: en
5
+ summary: "ML model serving discipline: startup-loaded singleton models, versioned endpoints, strict input validation, mandatory prediction logging, async drift checks, safe serialization."
6
+ source: "ai-ml/05-ml-fastapi-serving.md"
7
+ detect:
8
+ deps: { "fastapi": "*", "torch": "*" }
9
+ files: []
10
+ score: 8
11
+ requires: []
12
+ conflicts: []
13
+ tokens: 890
14
+ migrated: true
15
+ ---
16
+
17
+ # ML model serving (FastAPI)
18
+
19
+ Rules-only fragment; exemplar code lives in `references/ml-fastapi-serving/` and is read on demand.
20
+
21
+ ## Architecture rules
22
+
23
+ - Models load once at startup into a singleton (app lifespan hook), never per request; the service refuses traffic until the model is loaded.
24
+ - Prediction endpoints are versioned (`/v1/predict`, `/v2/predict`); a version is never removed without a migration path for its callers.
25
+ - Input validation is strict and happens before inference: wrong types, out-of-range values, and implausible feature combinations are rejected with a 4xx — the model never sees garbage.
26
+ - Request and response schemas are explicit models with field constraints; responses carry a prediction id and the serving model version.
27
+ - Every prediction is logged with its features, output, and model version — this log feeds monitoring and retraining and is not optional.
28
+ - Drift detection runs asynchronously in the background over buffered prediction features; it never blocks or slows the prediction path.
29
+ - Model A/B tests use weighted routing between loaded variants, and the serving variant is logged on every response for per-variant analysis.
30
+ - Serialization is format-safe: joblib for sklearn-family models; TorchScript or ONNX for deep-learning models. Never unpickle arbitrary objects from untrusted sources.
31
+ - A metrics endpoint (`/metrics`) exposes prediction count, latency histogram, error count by type, and a model-loaded gauge; a `/healthz` endpoint backs the container healthcheck.
32
+ - The container image is multi-stage, runs the API server directly, and declares a healthcheck.
33
+
34
+ ## Trigger → action
35
+
36
+ | Trigger | Action |
37
+ |---------|--------|
38
+ | New model version | new artifact → new versioned endpoint or A/B variant → keep old version serving |
39
+ | New feature in the input | extend the request schema with constraints → update the feature array mapping → retrain gate |
40
+ | Latency regression | check the latency histogram per model version → profile inference, not the framework |
41
+ | Drift alert | inspect the drift report → schedule retraining — never silently retrain in the serving process |
42
+ | Slow endpoint under load | verify the model is a startup singleton and inference is not re-loading artifacts |
43
+
44
+ ## Quality gates (before any PR)
45
+
46
+ - Model loads exactly once at startup; no artifact I/O on the request path.
47
+ - All inputs bounded by schema constraints; invalid payloads return 4xx with a clear message, never a 500 from inside inference.
48
+ - Prediction logging present on every endpoint, including the served variant on A/B routes.
49
+ - Metrics visible on `/metrics` (count, latency, errors, model-loaded) and `/healthz` returns the model status.
50
+ - Tests cover: valid prediction, out-of-range rejection, wrong-type rejection, and behavior when the model is not loaded.
51
+
52
+ ## Forbidden
53
+
54
+ - NEVER load model artifacts inside a request handler.
55
+ - NEVER skip input validation "because the model handles it" — it does not.
56
+ - NEVER serve a prediction without logging features and output.
57
+ - NEVER run drift checks synchronously in the prediction path.
58
+ - NEVER unpickle arbitrary objects — use joblib, TorchScript, or ONNX per model family.
59
+ - NEVER remove or change a versioned endpoint's contract without a migration path.
60
+
61
+ ## References (read on demand)
62
+
63
+ - `references/ml-fastapi-serving/serving-core.md` — singleton loader + lifespan, strict schemas, versioned predict endpoint, A/B routing.
64
+ - `references/ml-fastapi-serving/metrics-drift-docker.md` — Prometheus metrics, background drift detector, multi-stage Dockerfile.
@@ -0,0 +1,67 @@
1
+ ---
2
+ id: stack/ml-training-pipeline
3
+ version: 1.0.0
4
+ lang: en
5
+ summary: "ML training pipeline discipline: every run tracked, data versions tied to model versions, reproducible DVC stages, alias-based registry promotion gated by humans, pinned deps."
6
+ source: "ai-ml/09-ml-training-pipeline.md"
7
+ detect:
8
+ deps: { "torch": "*" }
9
+ files: []
10
+ score: 4
11
+ requires: []
12
+ conflicts: []
13
+ tokens: 856
14
+ migrated: true
15
+ ---
16
+
17
+ # ML training pipeline
18
+
19
+ Rules-only fragment; exemplar pipeline and CI code lives in `references/ml-training-pipeline/` and is read on demand.
20
+
21
+ ## Architecture rules
22
+
23
+ - Every training run is tracked in the experiment tracker (MLflow or equivalent) — params, per-epoch metrics, and artifacts. A run that is not tracked did not happen.
24
+ - Reproducibility is code + data + params: the pipeline is declared as versioned stages (DVC), and `dvc repro` from a clean checkout must reproduce the result.
25
+ - Data versions are bound to model versions: every registered model carries the data-version ref (DVC commit/tag) and git commit as tags.
26
+ - All tunables live in one tracked params file — never scattered constants in training scripts.
27
+ - Model registry lifecycle uses version aliases (`staging` → `production`); the older stage-transition API is deprecated. CI may point `staging`; only a human repoints `production`.
28
+ - Training CI runs the pipeline and enforces a metric quality gate (assert the eval metric meets the threshold) before registering to staging — it never auto-promotes to production.
29
+ - Log every epoch and prune nothing during training — disk is cheap, missing curves are not.
30
+ - Dependencies are pinned exactly for training environments; loose ranges make runs irreproducible.
31
+ - Raw and processed data are tracker-managed (DVC remote), never committed to git; the repo holds only `.dvc` pointers.
32
+
33
+ ## Naming
34
+
35
+ Experiment runs `{task}_{model}_{variant}_{YYYYMMDD}` · datasets tagged `data-vX.Y` in git · registered models named per task, versions carrying `git_commit`, `dvc_commit`, `trained_by`, and `dataset_version` tags.
36
+
37
+ ## Trigger → action
38
+
39
+ | Trigger | Action |
40
+ |---------|--------|
41
+ | New experiment idea | new params/config variant → tracked run → compare in the tracker UI, not in spreadsheets |
42
+ | Dataset update | `dvc add` → git tag the data version → re-run pipeline → new model version bound to it |
43
+ | Candidate model ready | CI metric gate → register → `staging` alias → human review → `production` alias |
44
+ | Result cannot be reproduced | check params file, data version, and pinned deps — one of them drifted |
45
+ | Metric regression in CI | gate fails, nothing is registered — investigate the run in the tracker |
46
+
47
+ ## Quality gates (before any PR)
48
+
49
+ - `dvc repro` runs clean from a fresh checkout; pipeline stages declare their real deps and outs.
50
+ - Every training entrypoint logs params, per-epoch metrics, and the model artifact to the tracker.
51
+ - Registered model versions carry git commit + data version tags.
52
+ - The CI metric threshold is explicit in the workflow, not hidden in a script default.
53
+ - No dataset files or model binaries committed to git; requirements pinned exactly.
54
+
55
+ ## Forbidden
56
+
57
+ - NEVER train without experiment tracking.
58
+ - NEVER register a model without its data-version and git-commit tags.
59
+ - NEVER auto-promote a model to production from CI — promotion is a human action.
60
+ - NEVER commit datasets or model weights to git — use the data-versioning remote.
61
+ - NEVER use loose dependency ranges in the training environment.
62
+ - NEVER tune values inline in scripts — every tunable goes through the params file.
63
+
64
+ ## References (read on demand)
65
+
66
+ - `references/ml-training-pipeline/dvc-pipeline.md` — pipeline stages, params file, data-versioning workflow.
67
+ - `references/ml-training-pipeline/mlflow-registry-ci.md` — tracked training loop, alias-based promotion, CI quality gate, naming/tags.
@@ -0,0 +1,68 @@
1
+ ---
2
+ id: stack/monitoring-observability
3
+ version: 1.0.0
4
+ lang: en
5
+ summary: "Observability discipline: boundary instrumentation, RED/USE methods, permanent metric names, structured logs, symptom-based alerts, dashboards as code."
6
+ source: "devops/06-monitoring-observability.md"
7
+ detect:
8
+ deps: {}
9
+ files: ["prometheus.yml", "grafana/**"]
10
+ score: 5
11
+ requires: []
12
+ conflicts: []
13
+ tokens: 868
14
+ migrated: true
15
+ ---
16
+
17
+ # Monitoring and observability
18
+
19
+ Rules-only fragment; exemplar instrumentation and configs live in `references/monitoring-observability/` and are read on demand.
20
+
21
+ ## Architecture rules
22
+
23
+ - Instrument at the boundary: HTTP in/out, DB calls, queue produce/consume — not every internal function.
24
+ - RED method for every service: Rate (req/s), Errors (error-rate %), Duration (latency p50/p95/p99). USE method for resources: Utilization, Saturation, Errors.
25
+ - Metric names are permanent — renaming is a breaking change. Format: `{service}_{noun}_{unit}_{type}`; durations in seconds, counters end in `_total`.
26
+ - Logs are for events, metrics for aggregates: never log a counter increment; emit a metric. Never store computed rates as metrics — rates are computed at query time.
27
+ - Structured JSON logs only, through the shared logger — no bare console/print. Sensitive fields (auth headers, passwords, tokens) are redacted at the logger.
28
+ - Traces, metrics, and logs flow through an OpenTelemetry collector pipeline; instrumentation bootstraps before any other application import.
29
+ - Health-check and metrics endpoints are excluded from tracing — they are noise.
30
+ - Alert on symptoms, not causes: high error rate or latency SLO breach, not "CPU > 80%". Every alert carries severity, owning team, and a runbook link.
31
+ - Dashboards are code: JSON provisioned from the repo — never click-built only.
32
+ - Business metrics (orders processed, active users) are first-class and live next to RED metrics.
33
+
34
+ ## Naming
35
+
36
+ `http_requests_total` (counter) · `http_request_duration_seconds` (histogram) · `pg_pool_connections` (gauge) · label cardinality bounded (no user ids or raw paths as label values) · alert names PascalCase stating the symptom (`HighErrorRate`).
37
+
38
+ ## Trigger → action
39
+
40
+ | Trigger | Action |
41
+ |---------|--------|
42
+ | New service | telemetry bootstrap first import → RED metrics + middleware → scrape target → RED dashboard → symptom alerts |
43
+ | New business KPI | counter/gauge with bounded labels — not a log line |
44
+ | Recurring incident | add the symptom alert + runbook; post-mortem decides the threshold |
45
+ | Noisy alert | tune `for:` duration and threshold, or delete it — alert fatigue is an outage risk |
46
+ | Debugging a slow request | trace first (span breakdown), then metrics, then logs by request id |
47
+
48
+ ## Quality gates (before any PR)
49
+
50
+ - New endpoints appear in RED metrics and traces without manual wiring (auto-instrumentation verified).
51
+ - Metric names follow the convention; no unbounded label cardinality introduced.
52
+ - No bare console/print logging; new log fields structured; secrets/PII covered by redaction.
53
+ - New alerts have severity, team, and runbook annotations, and were test-fired.
54
+ - Dashboards changed as JSON in the repo, not only in the UI.
55
+
56
+ ## Forbidden
57
+
58
+ - NEVER rename an existing metric — add a new one and deprecate the old.
59
+ - NEVER log what should be a metric, or store a precomputed rate as a metric.
60
+ - NEVER use unstructured string-concatenation logging.
61
+ - NEVER put user ids, emails, or raw URLs in metric label values.
62
+ - NEVER alert on causes (CPU%) when a symptom alert (error rate, latency) covers it.
63
+ - NEVER trace health-check or metrics endpoints.
64
+
65
+ ## References (read on demand)
66
+
67
+ - `references/monitoring-observability/instrumentation-node.md` — OTel bootstrap, RED metrics, middleware, structured logger.
68
+ - `references/monitoring-observability/alerts-and-config.md` — symptom alert rules, scrape config, dashboard-as-code, collector pipelines.
@@ -0,0 +1,68 @@
1
+ ---
2
+ id: stack/nestjs-typescript
3
+ version: 1.0.0
4
+ lang: en
5
+ summary: "NestJS API discipline: controller→service→repository layering, validated DTOs everywhere, guards for auth, global pipes/filters in main.ts, serialized response DTOs."
6
+ source: "backend/07-nestjs-typescript.md"
7
+ detect:
8
+ deps: { "@nestjs/core": "*" }
9
+ files: ["nest-cli.json"]
10
+ score: 10
11
+ requires: []
12
+ conflicts: []
13
+ tokens: 894
14
+ migrated: true
15
+ ---
16
+
17
+ # NestJS + TypeScript API
18
+
19
+ Rules-only fragment; exemplar code lives in `references/nestjs-typescript/` and is read on demand.
20
+
21
+ ## Architecture rules
22
+
23
+ - Strict layering: controller → service → repository (→ ORM client). Never skip a layer.
24
+ - Controllers only receive the request, call the service, and return — no business logic. Services hold business logic and never touch HTTP types or the ORM client directly. Repositories wrap the ORM for one domain — no business logic, no validators.
25
+ - One feature module per domain that owns an entity, at least one endpoint, and its own logic; utilities go to `common/`, config through the config module. Modules import only what they need and export only what other modules consume.
26
+ - Global pipes, guards, filters, and interceptors are registered once in `main.ts` — not per controller.
27
+ - The global ValidationPipe runs with whitelist + forbid-non-whitelisted + transform; every request body is a typed DTO with validation decorators.
28
+ - Authorization lives in guards and Passport strategies; guards answer a boolean, decorators (`@CurrentUser`, `@Roles`, `@Public`) carry the metadata.
29
+ - Responses go through response DTOs with sensitive fields excluded and a serializer interceptor — ORM model types never leak into API responses.
30
+ - Errors are `HttpException` subclasses; a global exception filter shapes the error envelope.
31
+
32
+ ## Trigger → action
33
+
34
+ | Trigger | Action |
35
+ |---------|--------|
36
+ | New domain | module + controller + service + repository + `dto/` folder → import in the root module |
37
+ | New endpoint | DTO with validation decorators → controller method → service → repository |
38
+ | Protected route | rely on the global auth guard; mark exceptions explicitly with `@Public()` |
39
+ | Role-restricted route | `@Roles(...)` + the roles guard — never inline role checks in services |
40
+ | Sensitive field in a response | response DTO with exclusion + serializer interceptor |
41
+ | Circular module dependency | redesign the boundary; `forwardRef()` only as a documented last resort |
42
+
43
+ ## Naming
44
+
45
+ Files `<name>.<kind>.ts` (`users.controller.ts`, `users.service.ts`, `users.repository.ts`) · DTOs `<Action><Entity>Dto` in `dto/` · guards/interceptors/filters under their module or `common/` · one class per file.
46
+
47
+ ## Quality gates (before any PR)
48
+
49
+ - Typecheck, build, and tests pass (exact commands come from PROJECT FACTS).
50
+ - Every new endpoint has a validated DTO; no `req.body` or unvalidated input reaches a service.
51
+ - Guards cover all endpoints; `@Public()` is explicit where auth is intentionally absent.
52
+ - No ORM client usage in controllers or services — repository only; no ORM types in responses.
53
+ - No circular imports between modules; providers registered in exactly one module.
54
+
55
+ ## Forbidden
56
+
57
+ - NEVER use `@Injectable()` without registering the class in a module's providers.
58
+ - NEVER import the ORM/database service into controllers or services — repositories own it.
59
+ - NEVER read `req.body` directly or omit the `@Body()` DTO — that bypasses validation.
60
+ - NEVER throw raw `Error` from request paths — use `HttpException` subclasses.
61
+ - NEVER put business logic in guards, or auth logic in services.
62
+ - NEVER expose ORM model types in API responses — response DTOs with excluded fields.
63
+ - NEVER use `@Global()` except for the database and config modules.
64
+
65
+ ## References (read on demand)
66
+
67
+ - `references/nestjs-typescript/guards-and-decorators.md` — JWT/roles guards, custom decorators, controller usage.
68
+ - `references/nestjs-typescript/modules-dtos-setup.md` — module template, validated DTOs, envelope interceptor, global bootstrap.
@@ -0,0 +1,65 @@
1
+ ---
2
+ id: stack/nextjs-app-router
3
+ version: 1.0.0
4
+ lang: en
5
+ summary: "Next.js App Router discipline: server-first components, route-group auth zones, validated Server Actions, segment-level loading/error boundaries."
6
+ source: "frontend/03-nextjs-app-router.md"
7
+ detect:
8
+ deps: { "next": ">=13" }
9
+ files: ["app/**/page.tsx", "next.config.*"]
10
+ score: 10
11
+ requires: []
12
+ conflicts: []
13
+ tokens: 853
14
+ migrated: true
15
+ ---
16
+
17
+ # Next.js (App Router)
18
+
19
+ Rules-only fragment; exemplar code is evicted to `references/nextjs-app-router/` and read on demand.
20
+
21
+ ## Architecture rules
22
+
23
+ - Server Components are the default. Add `"use client"` only at the leaves of the tree that need hooks, events, or browser APIs; the server parent fetches data and passes it down via props.
24
+ - Route groups split auth zones: public routes in one group, authenticated routes in another whose layout verifies the session; middleware matchers enforce redirects.
25
+ - `_`-prefixed folders are private (never become routes) — route-specific components live in `_components/` beside their `page.tsx`.
26
+ - Data fetching by location: Server Components use direct `async/await` for initial page data; Client Components use TanStack Query for data that changes at runtime; mutations go through Server Actions; Route Handlers (`app/api/*/route.ts`) exist only for webhooks and external integrations.
27
+ - Every Server Action follows the same contract: auth check → Zod validation → DB operation → `revalidatePath`/`revalidateTag`. Validation failures return structured field errors, never throw.
28
+ - DB schema: one file per table, `createdAt`/`updatedAt` on every table, explicit foreign keys, an index on every column used in a WHERE clause, inferred select/insert types exported.
29
+ - Every page exports `metadata` or `generateMetadata`; every async route segment has `loading.tsx`; every critical segment has `error.tsx`.
30
+
31
+ ## Trigger → action
32
+
33
+ | Trigger | Action |
34
+ |---------|--------|
35
+ | New feature | plan server/client split → route-group folder → `page.tsx` + `actions.ts` |
36
+ | Hydration error | find the `"use client"` boundary — push event handlers to a leaf component |
37
+ | Auth on a page | middleware matcher + session check in the group layout (Server Component) |
38
+ | Mutation with feedback | Server Action → `useActionState` or a TanStack mutation |
39
+ | Schema change | never edit an applied migration — generate a new one, review the diff, apply |
40
+ | Real-time data | Route Handler with SSE or an external socket — never polling in `useEffect` |
41
+
42
+ ## Naming
43
+
44
+ Routes: `page.tsx` / `layout.tsx` / `actions.ts` / `route.ts` · components `PascalCase.tsx` under `_components/` · private folders `_prefix` · DB schema files `snake_case` · types `PascalCase`.
45
+
46
+ ## Quality gates (before any PR)
47
+
48
+ - Production build and typecheck pass with zero errors (exact commands come from PROJECT FACTS).
49
+ - Every page has metadata; every async route has `loading.tsx`; critical routes have `error.tsx`.
50
+ - Every Server Action validates input with Zod before any DB call.
51
+ - No secret or server-only value reachable from the client bundle.
52
+ - Every schema change ships as a generated migration file.
53
+
54
+ ## Forbidden
55
+
56
+ - NEVER use the legacy `pages/api/` directory — Route Handlers only.
57
+ - NEVER fetch initial data in a Client Component on mount (`useEffect` fetch) — the Server Component owns it.
58
+ - NEVER use `<img>` — always the framework image component.
59
+ - NEVER import server-only modules into Client Components — guard them with the `server-only` package.
60
+ - NEVER put DB credentials or secrets in `NEXT_PUBLIC_*` env vars.
61
+ - NEVER call Server Actions conditionally during render — only from event handlers or form actions.
62
+
63
+ ## References (read on demand)
64
+
65
+ - `references/nextjs-app-router/patterns.md` — server/client component split, Server Action contract, auth middleware, metadata, Server Action testing.
@@ -0,0 +1,61 @@
1
+ ---
2
+ id: stack/nextjs-prisma-postgres
3
+ version: 1.0.0
4
+ lang: en
5
+ summary: "Next.js + ORM + Postgres SaaS discipline: migration-only schema changes, verified Stripe webhooks, server-side feature gating, transactional email."
6
+ source: "frontend/04-nextjs-prisma-postgres.md"
7
+ detect:
8
+ deps: { "next": ">=13", "prisma": "*" }
9
+ files: ["prisma/schema.prisma"]
10
+ score: 12
11
+ requires: []
12
+ conflicts: []
13
+ tokens: 833
14
+ migrated: true
15
+ ---
16
+
17
+ # Next.js + Postgres SaaS (billing + email)
18
+
19
+ Rules-only fragment; exemplar code is evicted to `references/nextjs-prisma-postgres/` and read on demand. Applies the App Router discipline (`stack/nextjs-app-router`) plus the database/billing rules below.
20
+
21
+ ## Architecture rules
22
+
23
+ - Database layer is isolated: schema definitions in one place (one file/model per table), generated migrations beside them, reusable query functions in `db/queries/` — pages and actions call query functions, never inline SQL.
24
+ - Every table carries `createdAt`/`updatedAt`; foreign keys are explicit with a deliberate `onDelete` behavior; subscription state lives in its own table keyed by the provider's subscription id.
25
+ - Schema changes ship ONLY as generated migrations: change the schema source → generate the migration → review the SQL diff → apply. Applied migrations are immutable; a mistake is reverted by a new migration.
26
+ - Stripe webhook handler: verify the signature before reading the event, then upsert idempotently (keyed on the provider id) so replays and out-of-order deliveries converge to the same state. Unhandled event types are acknowledged, not errored.
27
+ - Plan/feature gating is decided server-side (Server Action, Server Component, or API) by checking an active, unexpired subscription row — client-side plan checks are display-only.
28
+ - Checkout and billing-portal sessions are created server-side; the user id travels in provider metadata so webhooks can map events back to accounts.
29
+ - Transactional email goes through the email service with typed React templates; sends happen in Server Actions or jobs, never from the client.
30
+
31
+ ## Trigger → action
32
+
33
+ | Trigger | Action |
34
+ |---------|--------|
35
+ | New table/model | schema file → generate migration → review diff → apply |
36
+ | Schema mistake in prod | new corrective migration — never edit or delete an applied one |
37
+ | New webhook event | add a case to the handler → exercise it with the provider's CLI forwarder |
38
+ | Feature gate | server-side subscription check in the action/component that serves the feature |
39
+ | New plan/price | create in the provider dashboard → reference its id from config — never hardcode amounts |
40
+ | Email send | typed template → send via the email service inside a Server Action |
41
+
42
+ ## Quality gates (before any PR)
43
+
44
+ - Every schema change has a migration file; no manual SQL against production.
45
+ - Webhook handler exercised with provider CLI test events, including replay of the same event.
46
+ - Feature gates tested for both free and paid tiers, server-side.
47
+ - Production build passes; no DB access from Client Components.
48
+ - Prices and plan data come from the provider/config — never literals in the UI.
49
+
50
+ ## Forbidden
51
+
52
+ - NEVER skip webhook signature verification.
53
+ - NEVER hardcode prices or plan ids in components — provider API or config.
54
+ - NEVER store raw card data — the payment provider owns PCI scope.
55
+ - NEVER edit an applied migration file.
56
+ - NEVER expose the payment secret key or email API key to the client (no `NEXT_PUBLIC_*`).
57
+ - NEVER trust a client-supplied plan/role for access control — verify against the subscription table server-side.
58
+
59
+ ## References (read on demand)
60
+
61
+ - `references/nextjs-prisma-postgres/billing.md` — subscription schema, signature-verified idempotent webhook, checkout session, server-side feature gate, email send, webhook test.
@@ -0,0 +1,63 @@
1
+ ---
2
+ id: stack/nextjs-trpc-drizzle
3
+ version: 1.0.0
4
+ lang: en
5
+ summary: "Next.js + tRPC + Drizzle discipline: RSC caller vs client hooks, protected procedures, schema-as-migration-source, single DB client."
6
+ source: "fullstack/05-nextjs-trpc-drizzle.md"
7
+ detect:
8
+ deps: { "next": "*", "@trpc/server": "*", "drizzle-orm": "*" }
9
+ files: ["drizzle.config.*"]
10
+ score: 15
11
+ requires: []
12
+ conflicts: []
13
+ tokens: 836
14
+ migrated: true
15
+ ---
16
+
17
+ # Next.js + tRPC + Drizzle
18
+
19
+ Rules-only fragment; exemplar code is evicted to `references/nextjs-trpc-drizzle/` and read on demand.
20
+
21
+ ## Architecture rules
22
+
23
+ - App Router and tRPC coexist cleanly: Server Components call the server-side caller (`createCaller(ctx)`, no HTTP round trip); Client Components use the tRPC React hooks. Pick one pattern per page — never nest both.
24
+ - Server code lives under `src/server/` (auth config, DB client + schema, tRPC routers/context); the client-side tRPC provider and RSC caller live under `src/trpc/`. Client code never imports from `src/server/` except through the tRPC boundary.
25
+ - Drizzle schema files are the single source of truth for migrations: push for dev iteration, generated migrations for prod. Relations declared explicitly; ids generated by a collision-safe id function; FKs carry deliberate `onDelete` behavior.
26
+ - One DB client instance for the whole app; pick the serverless HTTP driver or a pool per runtime — never both, never per-request clients.
27
+ - Context is built once per request (session + db); `protectedProcedure` middleware enforces the session and narrows the context type — routers never re-check auth inline.
28
+ - Auth session type is augmented (module declaration) so `session.user.id` and `role` are typed; the session callback enriches them.
29
+ - Client mutations use optimistic updates via `useUtils` (cancel → snapshot → set → rollback on error → invalidate on settle); RSC-fetched data hydrates client queries through `initialData`.
30
+ - shadcn/ui components are owned local files — modify in place, never "update" by overwriting.
31
+
32
+ ## Trigger → action
33
+
34
+ | Trigger | Action |
35
+ |---------|--------|
36
+ | New API capability | procedure on a domain router → input schema (Zod) → typed return |
37
+ | Needs auth | `protectedProcedure` (or an ownership check inside it) — never inline token parsing |
38
+ | New table | schema file → generate/apply migration → relations + inferred types |
39
+ | Page needs data | RSC: server caller prefetch; interactive lists: hook with `initialData` |
40
+ | Mutation UX | optimistic update pattern with rollback |
41
+
42
+ ## Quality gates (before any PR)
43
+
44
+ - Typecheck and production build pass with zero errors (commands from PROJECT FACTS).
45
+ - Migrations in sync with schema (drizzle-kit check); connection string only in env, never committed.
46
+ - RSC pages prefetch through the server caller — no client-side waterfall for initial data.
47
+ - Session type augmentation present wherever `session.user.id`/`role` is read.
48
+ - Unit and e2e suites pass (login + a core mutation covered end-to-end).
49
+
50
+ ## Forbidden
51
+
52
+ - NEVER `fetch('/api/trpc/...')` manually — tRPC hooks or the server caller.
53
+ - NEVER mark a layout/page `"use client"` when it can stay a Server Component.
54
+ - NEVER type tRPC returns or Drizzle results as `any` — inference is the point of the stack.
55
+ - NEVER create multiple DB client instances.
56
+ - NEVER load data in `useEffect` — tRPC hooks or RSC.
57
+ - NEVER interpolate values into raw SQL — parameterized `sql` templates only.
58
+ - NEVER read non-public env vars in client code.
59
+
60
+ ## References (read on demand)
61
+
62
+ - `references/nextjs-trpc-drizzle/trpc-setup.md` — context, protected procedure, route handler, RSC caller.
63
+ - `references/nextjs-trpc-drizzle/data-and-auth.md` — Drizzle schema/relations, RSC+client hybrid with optimistic updates, auth config with session augmentation.
@@ -0,0 +1,60 @@
1
+ ---
2
+ id: stack/nodejs-express-typescript
3
+ version: 1.0.0
4
+ lang: en
5
+ summary: "Express + TypeScript REST discipline: router→controller→service→repository layering, Zod-validated env and input, HttpError-only responses, pure ESM."
6
+ source: "backend/01-nodejs-express-typescript.md"
7
+ detect:
8
+ deps: { "express": ">=4", "typescript": "*" }
9
+ files: ["tsconfig.json"]
10
+ score: 8
11
+ requires: []
12
+ conflicts: []
13
+ tokens: 858
14
+ migrated: true
15
+ ---
16
+
17
+ # Node.js REST API (Express + TypeScript)
18
+
19
+ Rules-only fragment; exemplar code is evicted to `references/nodejs-express-typescript/` and read on demand.
20
+
21
+ ## Architecture rules
22
+
23
+ - Strict layering: router → middleware → controller → service → repository → database. Never skip a layer.
24
+ - Controllers never import repositories — always through the service. Services never import Express types (`Request`/`Response`). Repositories are pure data access — no business branching.
25
+ - Each module is self-contained under `src/modules/<name>/`: router, controller, service, repository, Zod schema, types. Cross-module communication is service-to-service, never repo-to-repo.
26
+ - Cross-cutting concerns live outside modules: `src/config/` (Zod-validated env, DB client, app factory without `listen`), `src/middlewares/` (auth, validation factory, global error handler), `src/shared/` (error classes, augmented types). Entry point `src/server.ts` is the only place that listens.
27
+ - Environment is parsed once through a Zod schema at startup and the process exits on invalid config; nothing else reads `process.env`.
28
+ - Validation middleware parses body/query/params with the module's Zod schema and replaces the raw value with the coerced result before the controller runs.
29
+ - All failures flow through typed `HttpError`s caught by the single global error handler; stack traces and raw errors appear only outside production.
30
+ - Auth: JWT verification middleware attaches the typed payload to the request (declaration-merged type); role checks are a composable `authorize(...roles)` middleware. Short-lived access tokens, separate refresh secret.
31
+ - Pure ESM project — async errors rely on the framework's native async error propagation.
32
+
33
+ ## Naming
34
+
35
+ Modules `src/modules/<name>/<name>.router|controller|service|repository|schema|types.ts` · middleware `<name>.middleware.ts` · DB schema `src/db/schema/<table>.ts` · tests mirror source under `tests/unit/` and `tests/integration/`.
36
+
37
+ ## Quality gates (before any PR)
38
+
39
+ - Typecheck and tests pass with zero errors/failures (commands from PROJECT FACTS); coverage on new service/repository code meets the project bar.
40
+ - Every new route has an integration test (HTTP-level, against the app factory).
41
+ - No `any` — use `unknown` and narrow; no bare `console.log` in production paths (use the logger).
42
+ - New config values added to the env schema, never hardcoded.
43
+ - Error responses go through `HttpError`, not ad-hoc `res.status(...).json(...)`.
44
+ - API changes reflected in the OpenAPI spec or routing table.
45
+
46
+ ## Forbidden
47
+
48
+ - NEVER put SQL/ORM calls in controllers or services — repositories only.
49
+ - NEVER bypass the layer hierarchy (e.g., controller importing a repository).
50
+ - NEVER skip schema validation on incoming request data, and never `parseInt`/`parseFloat` user input outside schema coercion.
51
+ - NEVER store secrets in code — only via the validated env module.
52
+ - NEVER return stack traces, passwords, or token hashes in responses.
53
+ - NEVER use monkey-patch async-error packages — rely on native async error propagation.
54
+ - NEVER commit `.env` files — ship `.env.example`.
55
+ - NEVER use `require()` — the project is pure ESM.
56
+
57
+ ## References (read on demand)
58
+
59
+ - `references/nodejs-express-typescript/middleware.md` — JWT auth + role middleware, Zod validation factory, global error handler.
60
+ - `references/nodejs-express-typescript/config-and-tokens.md` — Zod-validated env module, token sign/verify service.
@@ -0,0 +1,62 @@
1
+ ---
2
+ id: stack/nuxt3-tailwind
3
+ version: 1.0.0
4
+ lang: en
5
+ summary: "Nuxt discipline: auto-import boundaries, composables vs utils, Zod-validated Nitro server routes, setup-store Pinia, SSR-aware fetching."
6
+ source: "frontend/11-nuxt3-tailwind.md"
7
+ detect:
8
+ deps: { "nuxt": ">=3" }
9
+ files: ["nuxt.config.*"]
10
+ score: 10
11
+ requires: []
12
+ conflicts: []
13
+ tokens: 850
14
+ migrated: true
15
+ ---
16
+
17
+ # Nuxt + Tailwind
18
+
19
+ Rules-only fragment; exemplar code is evicted to `references/nuxt3-tailwind/` and read on demand.
20
+
21
+ ## Architecture rules
22
+
23
+ - Respect the auto-import boundary: `components/`, `composables/`, `utils/` and the Vue/Nuxt APIs are auto-imported; `stores/` are imported explicitly; `server/` is a separate Nitro environment that pages/components/composables may NEVER import from.
24
+ - Composable vs util: reactive state (`ref`/`computed`) or SSR-aware fetching → composable `useXxx()`; pure functions → `utils/`; shared global state → Pinia store.
25
+ - Server routes are file-routed as `server/api/<route>.<method>.ts`; every handler validates the body with Zod before use, raises failures with `createError({ statusCode, message })`, and never returns sensitive fields. Authentication lives once in `server/middleware/`, not per handler.
26
+ - Pinia stores use the setup-store (Composition API) form only; async actions handle errors and reset loading flags in `finally`; stores never persist sensitive data client-side (httpOnly cookies on the server own that).
27
+ - Fetch decision: `useFetch` in page `<script setup>` (SSR + dedup); `useAsyncData` when you need key control; `$fetch` for event-driven one-shot mutations; each `useFetch`/`useAsyncData` has a unique key.
28
+ - Secrets live in `runtimeConfig` (server-only); only values safe for the browser go under `runtimeConfig.public`.
29
+ - Route middleware guards protected pages (`auth.global.ts` for app-wide checks); `routeRules` declares SSR/SPA/prerender zones deliberately per path.
30
+ - Components are 100% `<script setup>`; filenames define auto-import names, so name files deliberately.
31
+
32
+ ## Trigger → action
33
+
34
+ | Trigger | Action |
35
+ |---------|--------|
36
+ | New page | `pages/<path>.vue` → layout choice → middleware if protected |
37
+ | New API capability | `server/api/<route>.<method>.ts` → Zod schema → typed return |
38
+ | Reactive shared logic | composable in `composables/` — auto-imported |
39
+ | Global state | setup store in `stores/` — explicit import |
40
+ | Browser-only API | wrap in `onMounted` or an `import.meta.client` check |
41
+ | Static/landing content | prerender via `routeRules`; dashboard zones may opt out of SSR |
42
+
43
+ ## Quality gates (before any PR)
44
+
45
+ - Typecheck, lint (zero warnings), unit and e2e suites, and production build all pass (commands from PROJECT FACTS).
46
+ - Every server route validates input with Zod; auth middleware covers protected routes.
47
+ - No sensitive variable under `runtimeConfig.public`; no `console.log` in production code.
48
+ - Every `useFetch`/`useAsyncData` call has a unique key; `routeRules` reviewed for SSR/prerender fit.
49
+
50
+ ## Forbidden
51
+
52
+ - NEVER import `server/` code into pages, components, or composables.
53
+ - NEVER put secrets in `runtimeConfig.public`.
54
+ - NEVER touch `localStorage`, `document`, or `window` outside `onMounted`/client checks — wrap in a composable.
55
+ - NEVER fetch in `mounted()` — `useFetch`/`useAsyncData` in `<script setup>`.
56
+ - NEVER use `any`, mix Options API with Composition API, or write components without `<script setup>`.
57
+ - NEVER hardcode environment values — `runtimeConfig` only.
58
+
59
+ ## References (read on demand)
60
+
61
+ - `references/nuxt3-tailwind/server-routes.md` — validated Nitro handlers, server middleware auth, runtime config, route rules.
62
+ - `references/nuxt3-tailwind/state-and-fetching.md` — setup-store Pinia, composable vs util exemplars, fetch decision table, route middleware, tests.
@@ -0,0 +1,58 @@
1
+ ---
2
+ id: stack/openai-api-integration
3
+ version: 1.0.0
4
+ lang: en
5
+ summary: "LLM API integration discipline: singleton client, pre-call token budgets, input moderation, deterministic-call caching, streaming, typed error handling."
6
+ source: "ai-ml/02-openai-api-integration.md"
7
+ detect:
8
+ deps: { "openai": "*" }
9
+ files: []
10
+ score: 8
11
+ requires: []
12
+ conflicts: []
13
+ tokens: 799
14
+ migrated: true
15
+ ---
16
+
17
+ # OpenAI API Integration (Node.js + TypeScript)
18
+
19
+ Rules-only fragment; exemplar code is evicted to `references/openai-api-integration/` and read on demand. Model ids and pricing come from versioned config (`models.json`) — never from prose or literals in code.
20
+
21
+ ## Critical rules
22
+
23
+ 1. Single client instance — instantiate once with retries and a timeout, import everywhere. Never construct a client per request.
24
+ 2. Estimate tokens and cost BEFORE the call; reject requests that would exceed the per-call budget. Cost surprises are a bug class, not an accident.
25
+ 3. Moderate user-provided content with the Moderation API before it reaches a completion call; raise a typed content-policy error when flagged.
26
+ 4. Cache deterministic calls: `temperature: 0` plus identical model+messages is cacheable by prompt hash in Redis (TTL at least one hour). Non-deterministic calls are never cached.
27
+ 5. Stream anything long-running to the client (SSE); never block a request for a full completion. Log token usage from the final completion after the stream ends.
28
+ 6. Structured extraction uses the SDK's native parse helpers with a Zod schema (`zodResponseFormat`) — never regex-parse JSON out of free text. Tool/function definitions use strict schemas with `additionalProperties: false`.
29
+ 7. Tool-calling loop: append the assistant message, execute each tool call, append `role: "tool"` results by `tool_call_id`, then make the follow-up call.
30
+ 8. Handle SDK error classes individually (rate limit, auth, bad request, connection) — never collapse everything into a generic 500; re-throw unknowns.
31
+ 9. Track cost per feature: tag every call with feature metadata and aggregate usage so spend is attributable.
32
+
33
+ ## Naming
34
+
35
+ Client/cache/moderation/cost helpers in `src/lib/` · call sites in `src/services/` (chat, extraction, streaming) · output schemas in `src/schemas/` · retry/token counting in `src/utils/`.
36
+
37
+ ## Quality gates (before any PR)
38
+
39
+ - Every completion call site: budget check before, usage logging after, typed error handling around.
40
+ - Every user-input path passes moderation before the LLM sees it.
41
+ - Structured outputs validated by schema — a parse failure is an explicit error, not a silent fallback.
42
+ - Cache keys include model + messages hash and are only issued for deterministic calls.
43
+ - Model ids and pricing referenced from config, never inline.
44
+
45
+ ## Forbidden
46
+
47
+ - NEVER instantiate the API client per request or per module.
48
+ - NEVER hardcode model ids, prices, or budgets in code — config only.
49
+ - NEVER regex- or string-parse model JSON output — schema-validated parse helpers.
50
+ - NEVER expose the API key to the client side or commit it; env only.
51
+ - NEVER swallow rate-limit errors — surface retry-after and back off.
52
+ - NEVER send unmoderated user content to a completion endpoint.
53
+ - NEVER block a user-facing request on a long completion — stream it.
54
+
55
+ ## References (read on demand)
56
+
57
+ - `references/openai-api-integration/client-and-cost.md` — singleton client, config-driven pricing, pre-call token estimation and budget assertion.
58
+ - `references/openai-api-integration/calls.md` — moderation gate, structured outputs with Zod, Redis caching, SSE streaming, tool-calling loop, typed error handling.