claude-autopm 2.8.1 → 2.8.3
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/README.md +399 -529
- package/bin/autopm.js +2 -0
- package/bin/commands/plugin.js +395 -0
- package/bin/commands/team.js +184 -10
- package/install/install.js +223 -4
- package/lib/plugins/PluginManager.js +1328 -0
- package/lib/plugins/PluginManager.old.js +400 -0
- package/package.json +5 -1
- package/packages/plugin-ai/LICENSE +21 -0
- package/packages/plugin-ai/README.md +316 -0
- package/packages/plugin-ai/agents/anthropic-claude-expert.md +579 -0
- package/packages/plugin-ai/agents/azure-openai-expert.md +1411 -0
- package/packages/plugin-ai/agents/google-a2a-expert.md +1445 -0
- package/packages/plugin-ai/agents/huggingface-expert.md +2131 -0
- package/packages/plugin-ai/agents/langchain-expert.md +1427 -0
- package/packages/plugin-ai/commands/a2a-setup.md +886 -0
- package/packages/plugin-ai/commands/ai-model-deployment.md +481 -0
- package/packages/plugin-ai/commands/anthropic-optimize.md +793 -0
- package/packages/plugin-ai/commands/huggingface-deploy.md +789 -0
- package/packages/plugin-ai/commands/langchain-optimize.md +807 -0
- package/packages/plugin-ai/commands/llm-optimize.md +348 -0
- package/packages/plugin-ai/commands/openai-optimize.md +863 -0
- package/packages/plugin-ai/commands/rag-optimize.md +841 -0
- package/packages/plugin-ai/commands/rag-setup-scaffold.md +382 -0
- package/packages/plugin-ai/package.json +66 -0
- package/packages/plugin-ai/plugin.json +519 -0
- package/packages/plugin-ai/rules/ai-model-standards.md +449 -0
- package/packages/plugin-ai/rules/prompt-engineering-standards.md +509 -0
- package/packages/plugin-ai/scripts/examples/huggingface-inference-example.py +145 -0
- package/packages/plugin-ai/scripts/examples/langchain-rag-example.py +366 -0
- package/packages/plugin-ai/scripts/examples/mlflow-tracking-example.py +224 -0
- package/packages/plugin-ai/scripts/examples/openai-chat-example.py +425 -0
- package/packages/plugin-cloud/README.md +268 -0
- package/packages/plugin-cloud/agents/gemini-api-expert.md +880 -0
- package/packages/plugin-cloud/agents/openai-python-expert.md +1087 -0
- package/packages/plugin-cloud/commands/cloud-cost-optimize.md +243 -0
- package/packages/plugin-cloud/commands/cloud-validate.md +196 -0
- package/packages/plugin-cloud/hooks/pre-cloud-deploy.js +456 -0
- package/packages/plugin-cloud/package.json +64 -0
- package/packages/plugin-cloud/plugin.json +338 -0
- package/packages/plugin-cloud/rules/cloud-security-compliance.md +313 -0
- package/packages/plugin-cloud/scripts/examples/aws-validate.sh +30 -0
- package/packages/plugin-cloud/scripts/examples/azure-setup.sh +33 -0
- package/packages/plugin-cloud/scripts/examples/gcp-setup.sh +39 -0
- package/packages/plugin-cloud/scripts/examples/k8s-validate.sh +40 -0
- package/packages/plugin-cloud/scripts/examples/terraform-init.sh +26 -0
- package/packages/plugin-core/README.md +274 -0
- package/packages/plugin-core/commands/code-rabbit.md +128 -0
- package/packages/plugin-core/commands/prompt.md +9 -0
- package/packages/plugin-core/commands/re-init.md +9 -0
- package/packages/plugin-core/hooks/context7-reminder.md +29 -0
- package/packages/plugin-core/hooks/enforce-agents.js +125 -0
- package/packages/plugin-core/hooks/enforce-agents.sh +35 -0
- package/packages/plugin-core/hooks/pre-agent-context7.js +224 -0
- package/packages/plugin-core/hooks/pre-command-context7.js +229 -0
- package/packages/plugin-core/hooks/strict-enforce-agents.sh +39 -0
- package/packages/plugin-core/hooks/test-hook.sh +21 -0
- package/packages/plugin-core/hooks/unified-context7-enforcement.sh +38 -0
- package/packages/plugin-core/package.json +45 -0
- package/packages/plugin-core/plugin.json +387 -0
- package/packages/plugin-core/rules/agent-coordination.md +549 -0
- package/packages/plugin-core/rules/agent-mandatory.md +170 -0
- package/packages/plugin-core/rules/command-pipelines.md +208 -0
- package/packages/plugin-core/rules/context-optimization.md +176 -0
- package/packages/plugin-core/rules/context7-enforcement.md +327 -0
- package/packages/plugin-core/rules/datetime.md +122 -0
- package/packages/plugin-core/rules/definition-of-done.md +272 -0
- package/packages/plugin-core/rules/development-environments.md +19 -0
- package/packages/plugin-core/rules/development-workflow.md +198 -0
- package/packages/plugin-core/rules/framework-path-rules.md +180 -0
- package/packages/plugin-core/rules/frontmatter-operations.md +64 -0
- package/packages/plugin-core/rules/git-strategy.md +237 -0
- package/packages/plugin-core/rules/golden-rules.md +181 -0
- package/packages/plugin-core/rules/naming-conventions.md +111 -0
- package/packages/plugin-core/rules/no-pr-workflow.md +183 -0
- package/packages/plugin-core/rules/pipeline-mandatory.md +109 -0
- package/packages/plugin-core/rules/security-checklist.md +318 -0
- package/packages/plugin-core/rules/standard-patterns.md +197 -0
- package/packages/plugin-core/rules/strip-frontmatter.md +85 -0
- package/packages/plugin-core/rules/tdd.enforcement.md +103 -0
- package/packages/plugin-core/rules/use-ast-grep.md +113 -0
- package/packages/plugin-core/scripts/lib/datetime-utils.sh +254 -0
- package/packages/plugin-core/scripts/lib/frontmatter-utils.sh +294 -0
- package/packages/plugin-core/scripts/lib/github-utils.sh +221 -0
- package/packages/plugin-core/scripts/lib/logging-utils.sh +199 -0
- package/packages/plugin-core/scripts/lib/validation-utils.sh +339 -0
- package/packages/plugin-core/scripts/mcp/add.sh +7 -0
- package/packages/plugin-core/scripts/mcp/disable.sh +12 -0
- package/packages/plugin-core/scripts/mcp/enable.sh +12 -0
- package/packages/plugin-core/scripts/mcp/list.sh +7 -0
- package/packages/plugin-core/scripts/mcp/sync.sh +8 -0
- package/packages/plugin-data/README.md +315 -0
- package/packages/plugin-data/agents/airflow-orchestration-expert.md +158 -0
- package/packages/plugin-data/agents/kedro-pipeline-expert.md +304 -0
- package/packages/plugin-data/agents/langgraph-workflow-expert.md +530 -0
- package/packages/plugin-data/commands/airflow-dag-scaffold.md +413 -0
- package/packages/plugin-data/commands/kafka-pipeline-scaffold.md +503 -0
- package/packages/plugin-data/package.json +66 -0
- package/packages/plugin-data/plugin.json +294 -0
- package/packages/plugin-data/rules/data-quality-standards.md +373 -0
- package/packages/plugin-data/rules/etl-pipeline-standards.md +255 -0
- package/packages/plugin-data/scripts/examples/airflow-dag-example.py +245 -0
- package/packages/plugin-data/scripts/examples/dbt-transform-example.sql +238 -0
- package/packages/plugin-data/scripts/examples/kafka-streaming-example.py +257 -0
- package/packages/plugin-data/scripts/examples/pandas-etl-example.py +332 -0
- package/packages/plugin-databases/README.md +330 -0
- package/{autopm/.claude/agents/databases → packages/plugin-databases/agents}/bigquery-expert.md +24 -15
- package/{autopm/.claude/agents/databases → packages/plugin-databases/agents}/cosmosdb-expert.md +22 -15
- package/{autopm/.claude/agents/databases → packages/plugin-databases/agents}/mongodb-expert.md +24 -15
- package/{autopm/.claude/agents/databases → packages/plugin-databases/agents}/postgresql-expert.md +23 -15
- package/{autopm/.claude/agents/databases → packages/plugin-databases/agents}/redis-expert.md +29 -7
- package/packages/plugin-databases/commands/db-optimize.md +612 -0
- package/packages/plugin-databases/package.json +60 -0
- package/packages/plugin-databases/plugin.json +237 -0
- package/packages/plugin-databases/rules/database-management-strategy.md +146 -0
- package/packages/plugin-databases/rules/database-pipeline.md +316 -0
- package/packages/plugin-databases/scripts/examples/bigquery-cost-analyze.sh +160 -0
- package/packages/plugin-databases/scripts/examples/cosmosdb-ru-optimize.sh +163 -0
- package/packages/plugin-databases/scripts/examples/mongodb-shard-check.sh +120 -0
- package/packages/plugin-databases/scripts/examples/postgres-index-analyze.sh +95 -0
- package/packages/plugin-databases/scripts/examples/redis-cache-stats.sh +121 -0
- package/packages/plugin-devops/README.md +367 -0
- package/{autopm/.claude/agents/devops → packages/plugin-devops/agents}/github-operations-specialist.md +1 -1
- package/packages/plugin-devops/commands/ci-pipeline-create.md +581 -0
- package/packages/plugin-devops/commands/docker-optimize.md +493 -0
- package/packages/plugin-devops/hooks/pre-docker-build.js +472 -0
- package/packages/plugin-devops/package.json +61 -0
- package/packages/plugin-devops/plugin.json +302 -0
- package/packages/plugin-devops/rules/github-operations.md +92 -0
- package/packages/plugin-devops/scripts/examples/docker-build-multistage.sh +43 -0
- package/packages/plugin-devops/scripts/examples/docker-compose-validate.sh +74 -0
- package/packages/plugin-devops/scripts/examples/github-workflow-validate.sh +48 -0
- package/packages/plugin-devops/scripts/examples/prometheus-health-check.sh +58 -0
- package/packages/plugin-devops/scripts/examples/ssh-key-setup.sh +74 -0
- package/packages/plugin-frameworks/README.md +309 -0
- package/{autopm/.claude/agents/frameworks → packages/plugin-frameworks/agents}/e2e-test-engineer.md +219 -0
- package/{autopm/.claude/agents/frameworks → packages/plugin-frameworks/agents}/react-frontend-engineer.md +176 -0
- package/{autopm/.claude/agents/frameworks → packages/plugin-frameworks/agents}/tailwindcss-expert.md +251 -0
- package/packages/plugin-frameworks/commands/nextjs-optimize.md +692 -0
- package/packages/plugin-frameworks/commands/react-optimize.md +583 -0
- package/packages/plugin-frameworks/package.json +59 -0
- package/packages/plugin-frameworks/plugin.json +224 -0
- package/packages/plugin-frameworks/rules/performance-guidelines.md +403 -0
- package/packages/plugin-frameworks/scripts/examples/react-component-perf.sh +34 -0
- package/packages/plugin-frameworks/scripts/examples/tailwind-optimize.sh +44 -0
- package/packages/plugin-frameworks/scripts/examples/vue-composition-check.sh +41 -0
- package/packages/plugin-languages/README.md +333 -0
- package/packages/plugin-languages/commands/javascript-optimize.md +636 -0
- package/packages/plugin-languages/commands/nodejs-api-scaffold.md +341 -0
- package/packages/plugin-languages/commands/nodejs-optimize.md +689 -0
- package/packages/plugin-languages/commands/python-api-scaffold.md +261 -0
- package/packages/plugin-languages/commands/python-optimize.md +593 -0
- package/packages/plugin-languages/package.json +65 -0
- package/packages/plugin-languages/plugin.json +265 -0
- package/packages/plugin-languages/rules/code-quality-standards.md +496 -0
- package/packages/plugin-languages/rules/testing-standards.md +768 -0
- package/packages/plugin-languages/scripts/examples/bash-production-script.sh +520 -0
- package/packages/plugin-languages/scripts/examples/javascript-es6-patterns.js +291 -0
- package/packages/plugin-languages/scripts/examples/nodejs-async-iteration.js +360 -0
- package/packages/plugin-languages/scripts/examples/python-async-patterns.py +289 -0
- package/packages/plugin-languages/scripts/examples/typescript-patterns.ts +432 -0
- package/packages/plugin-ml/README.md +430 -0
- package/packages/plugin-ml/agents/automl-expert.md +326 -0
- package/packages/plugin-ml/agents/computer-vision-expert.md +550 -0
- package/packages/plugin-ml/agents/gradient-boosting-expert.md +455 -0
- package/packages/plugin-ml/agents/neural-network-architect.md +1228 -0
- package/packages/plugin-ml/agents/nlp-transformer-expert.md +584 -0
- package/packages/plugin-ml/agents/pytorch-expert.md +412 -0
- package/packages/plugin-ml/agents/reinforcement-learning-expert.md +2088 -0
- package/packages/plugin-ml/agents/scikit-learn-expert.md +228 -0
- package/packages/plugin-ml/agents/tensorflow-keras-expert.md +509 -0
- package/packages/plugin-ml/agents/time-series-expert.md +303 -0
- package/packages/plugin-ml/commands/ml-automl.md +572 -0
- package/packages/plugin-ml/commands/ml-train-optimize.md +657 -0
- package/packages/plugin-ml/package.json +52 -0
- package/packages/plugin-ml/plugin.json +338 -0
- package/packages/plugin-pm/README.md +368 -0
- package/packages/plugin-pm/claudeautopm-plugin-pm-2.0.0.tgz +0 -0
- package/packages/plugin-pm/commands/github/workflow-create.md +42 -0
- package/packages/plugin-pm/package.json +57 -0
- package/packages/plugin-pm/plugin.json +503 -0
- package/packages/plugin-testing/README.md +401 -0
- package/{autopm/.claude/agents/testing → packages/plugin-testing/agents}/frontend-testing-engineer.md +373 -0
- package/packages/plugin-testing/commands/jest-optimize.md +800 -0
- package/packages/plugin-testing/commands/playwright-optimize.md +887 -0
- package/packages/plugin-testing/commands/test-coverage.md +512 -0
- package/packages/plugin-testing/commands/test-performance.md +1041 -0
- package/packages/plugin-testing/commands/test-setup.md +414 -0
- package/packages/plugin-testing/package.json +40 -0
- package/packages/plugin-testing/plugin.json +197 -0
- package/packages/plugin-testing/rules/test-coverage-requirements.md +581 -0
- package/packages/plugin-testing/rules/testing-standards.md +529 -0
- package/packages/plugin-testing/scripts/examples/react-testing-example.test.jsx +460 -0
- package/packages/plugin-testing/scripts/examples/vitest-config-example.js +352 -0
- package/packages/plugin-testing/scripts/examples/vue-testing-example.test.js +586 -0
- package/scripts/publish-plugins.sh +166 -0
- package/autopm/.claude/agents/data/airflow-orchestration-expert.md +0 -52
- package/autopm/.claude/agents/data/kedro-pipeline-expert.md +0 -50
- package/autopm/.claude/agents/integration/message-queue-engineer.md +0 -794
- package/autopm/.claude/commands/ai/langgraph-workflow.md +0 -65
- package/autopm/.claude/commands/ai/openai-chat.md +0 -65
- package/autopm/.claude/commands/playwright/test-scaffold.md +0 -38
- package/autopm/.claude/commands/python/api-scaffold.md +0 -50
- package/autopm/.claude/commands/python/docs-query.md +0 -48
- package/autopm/.claude/commands/testing/prime.md +0 -314
- package/autopm/.claude/commands/testing/run.md +0 -125
- package/autopm/.claude/commands/ui/bootstrap-scaffold.md +0 -65
- package/autopm/.claude/rules/database-management-strategy.md +0 -17
- package/autopm/.claude/rules/database-pipeline.md +0 -94
- package/autopm/.claude/rules/ux-design-rules.md +0 -209
- package/autopm/.claude/rules/visual-testing.md +0 -223
- package/autopm/.claude/scripts/azure/README.md +0 -192
- package/autopm/.claude/scripts/azure/active-work.js +0 -524
- package/autopm/.claude/scripts/azure/active-work.sh +0 -20
- package/autopm/.claude/scripts/azure/blocked.js +0 -520
- package/autopm/.claude/scripts/azure/blocked.sh +0 -20
- package/autopm/.claude/scripts/azure/daily.js +0 -533
- package/autopm/.claude/scripts/azure/daily.sh +0 -20
- package/autopm/.claude/scripts/azure/dashboard.js +0 -970
- package/autopm/.claude/scripts/azure/dashboard.sh +0 -20
- package/autopm/.claude/scripts/azure/feature-list.js +0 -254
- package/autopm/.claude/scripts/azure/feature-list.sh +0 -20
- package/autopm/.claude/scripts/azure/feature-show.js +0 -7
- package/autopm/.claude/scripts/azure/feature-show.sh +0 -20
- package/autopm/.claude/scripts/azure/feature-status.js +0 -604
- package/autopm/.claude/scripts/azure/feature-status.sh +0 -20
- package/autopm/.claude/scripts/azure/help.js +0 -342
- package/autopm/.claude/scripts/azure/help.sh +0 -20
- package/autopm/.claude/scripts/azure/next-task.js +0 -508
- package/autopm/.claude/scripts/azure/next-task.sh +0 -20
- package/autopm/.claude/scripts/azure/search.js +0 -469
- package/autopm/.claude/scripts/azure/search.sh +0 -20
- package/autopm/.claude/scripts/azure/setup.js +0 -745
- package/autopm/.claude/scripts/azure/setup.sh +0 -20
- package/autopm/.claude/scripts/azure/sprint-report.js +0 -1012
- package/autopm/.claude/scripts/azure/sprint-report.sh +0 -20
- package/autopm/.claude/scripts/azure/sync.js +0 -563
- package/autopm/.claude/scripts/azure/sync.sh +0 -20
- package/autopm/.claude/scripts/azure/us-list.js +0 -210
- package/autopm/.claude/scripts/azure/us-list.sh +0 -20
- package/autopm/.claude/scripts/azure/us-status.js +0 -238
- package/autopm/.claude/scripts/azure/us-status.sh +0 -20
- package/autopm/.claude/scripts/azure/validate.js +0 -626
- package/autopm/.claude/scripts/azure/validate.sh +0 -20
- package/autopm/.claude/scripts/azure/wrapper-template.sh +0 -20
- package/autopm/.claude/scripts/github/dependency-tracker.js +0 -554
- package/autopm/.claude/scripts/github/dependency-validator.js +0 -545
- package/autopm/.claude/scripts/github/dependency-visualizer.js +0 -477
- package/bin/node/azure-feature-show.js +0 -7
- /package/{autopm/.claude/agents/cloud → packages/plugin-ai/agents}/gemini-api-expert.md +0 -0
- /package/{autopm/.claude/agents/data → packages/plugin-ai/agents}/langgraph-workflow-expert.md +0 -0
- /package/{autopm/.claude/agents/cloud → packages/plugin-ai/agents}/openai-python-expert.md +0 -0
- /package/{autopm/.claude/agents/cloud → packages/plugin-cloud/agents}/README.md +0 -0
- /package/{autopm/.claude/agents/cloud → packages/plugin-cloud/agents}/aws-cloud-architect.md +0 -0
- /package/{autopm/.claude/agents/cloud → packages/plugin-cloud/agents}/azure-cloud-architect.md +0 -0
- /package/{autopm/.claude/agents/cloud → packages/plugin-cloud/agents}/gcp-cloud-architect.md +0 -0
- /package/{autopm/.claude/agents/cloud → packages/plugin-cloud/agents}/gcp-cloud-functions-engineer.md +0 -0
- /package/{autopm/.claude/agents/cloud → packages/plugin-cloud/agents}/kubernetes-orchestrator.md +0 -0
- /package/{autopm/.claude/agents/cloud → packages/plugin-cloud/agents}/terraform-infrastructure-expert.md +0 -0
- /package/{autopm/.claude/commands/cloud → packages/plugin-cloud/commands}/infra-deploy.md +0 -0
- /package/{autopm/.claude/commands/kubernetes/deploy.md → packages/plugin-cloud/commands/k8s-deploy.md} +0 -0
- /package/{autopm/.claude/commands/infrastructure → packages/plugin-cloud/commands}/ssh-security.md +0 -0
- /package/{autopm/.claude/commands/infrastructure → packages/plugin-cloud/commands}/traefik-setup.md +0 -0
- /package/{autopm/.claude → packages/plugin-cloud}/rules/infrastructure-pipeline.md +0 -0
- /package/{autopm/.claude → packages/plugin-core}/agents/core/agent-manager.md +0 -0
- /package/{autopm/.claude → packages/plugin-core}/agents/core/code-analyzer.md +0 -0
- /package/{autopm/.claude → packages/plugin-core}/agents/core/file-analyzer.md +0 -0
- /package/{autopm/.claude → packages/plugin-core}/agents/core/test-runner.md +0 -0
- /package/{autopm/.claude → packages/plugin-core}/rules/ai-integration-patterns.md +0 -0
- /package/{autopm/.claude → packages/plugin-core}/rules/performance-guidelines.md +0 -0
- /package/{autopm/.claude/agents/databases → packages/plugin-databases/agents}/README.md +0 -0
- /package/{autopm/.claude/agents/devops → packages/plugin-devops/agents}/README.md +0 -0
- /package/{autopm/.claude/agents/devops → packages/plugin-devops/agents}/azure-devops-specialist.md +0 -0
- /package/{autopm/.claude/agents/devops → packages/plugin-devops/agents}/docker-containerization-expert.md +0 -0
- /package/{autopm/.claude/agents/devops → packages/plugin-devops/agents}/mcp-context-manager.md +0 -0
- /package/{autopm/.claude/agents/devops → packages/plugin-devops/agents}/observability-engineer.md +0 -0
- /package/{autopm/.claude/agents/devops → packages/plugin-devops/agents}/ssh-operations-expert.md +0 -0
- /package/{autopm/.claude/agents/devops → packages/plugin-devops/agents}/traefik-proxy-expert.md +0 -0
- /package/{autopm/.claude/commands/github → packages/plugin-devops/commands}/workflow-create.md +0 -0
- /package/{autopm/.claude → packages/plugin-devops}/rules/ci-cd-kubernetes-strategy.md +0 -0
- /package/{autopm/.claude → packages/plugin-devops}/rules/devops-troubleshooting-playbook.md +0 -0
- /package/{autopm/.claude → packages/plugin-devops}/rules/docker-first-development.md +0 -0
- /package/{autopm/.claude/agents/frameworks → packages/plugin-frameworks/agents}/README.md +0 -0
- /package/{autopm/.claude/agents/frameworks → packages/plugin-frameworks/agents}/nats-messaging-expert.md +0 -0
- /package/{autopm/.claude/agents/frameworks → packages/plugin-frameworks/agents}/react-ui-expert.md +0 -0
- /package/{autopm/.claude/agents/frameworks → packages/plugin-frameworks/agents}/ux-design-expert.md +0 -0
- /package/{autopm/.claude/commands/react → packages/plugin-frameworks/commands}/app-scaffold.md +0 -0
- /package/{autopm/.claude/commands/ui → packages/plugin-frameworks/commands}/tailwind-system.md +0 -0
- /package/{autopm/.claude → packages/plugin-frameworks}/rules/ui-development-standards.md +0 -0
- /package/{autopm/.claude → packages/plugin-frameworks}/rules/ui-framework-rules.md +0 -0
- /package/{autopm/.claude/agents/languages → packages/plugin-languages/agents}/README.md +0 -0
- /package/{autopm/.claude/agents/languages → packages/plugin-languages/agents}/bash-scripting-expert.md +0 -0
- /package/{autopm/.claude/agents/languages → packages/plugin-languages/agents}/javascript-frontend-engineer.md +0 -0
- /package/{autopm/.claude/agents/languages → packages/plugin-languages/agents}/nodejs-backend-engineer.md +0 -0
- /package/{autopm/.claude/agents/languages → packages/plugin-languages/agents}/python-backend-engineer.md +0 -0
- /package/{autopm/.claude/agents/languages → packages/plugin-languages/agents}/python-backend-expert.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/COMMANDS.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/COMMAND_MAPPING.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/INTEGRATION_FIX.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/README.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/active-work.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/aliases.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/blocked-items.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/clean.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/docs-query.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/feature-decompose.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/feature-list.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/feature-new.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/feature-show.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/feature-start.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/fix-integration-example.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/help.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/import-us.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/init.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/next-task.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/search.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/sprint-status.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/standup.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/sync-all.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/task-analyze.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/task-close.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/task-edit.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/task-list.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/task-new.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/task-reopen.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/task-show.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/task-start.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/task-status.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/task-sync.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/us-edit.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/us-list.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/us-new.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/us-parse.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/us-show.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/us-status.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/validate.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/commands/azure/work-item-sync.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/blocked.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/clean.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/context-create.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/context-prime.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/context-update.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/context.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-close.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-decompose.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-edit.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-list.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-merge.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-oneshot.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-refresh.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-show.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-split.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-start.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-status.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-sync-modular.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-sync-original.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/epic-sync.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/help.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/import.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/in-progress.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/init.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/issue-analyze.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/issue-close.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/issue-edit.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/issue-reopen.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/issue-show.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/issue-start.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/issue-status.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/issue-sync.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/next.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/prd-edit.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/prd-list.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/prd-new.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/prd-parse.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/prd-status.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/search.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/standup.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/status.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/sync.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/test-reference-update.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/validate.md +0 -0
- /package/{autopm/.claude/commands/pm → packages/plugin-pm/commands}/what-next.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/analytics.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/blocked.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/blocked.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/clean.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/context-create.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/context-prime.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/context-update.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/context.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-close.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-edit.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-list.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-list.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-show.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-show.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-split.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-start/epic-start.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-start/epic-start.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-status.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-status.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-sync/README.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-sync/create-epic-issue.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-sync/create-task-issues.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-sync/update-epic-file.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-sync/update-references.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/epic-sync.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/help.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/help.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/in-progress.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/in-progress.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/init.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/init.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/issue-close.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/issue-edit.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/issue-show.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/issue-start.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/issue-sync/format-comment.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/issue-sync/gather-updates.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/issue-sync/post-comment.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/issue-sync/preflight-validation.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/issue-sync/update-frontmatter.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/lib/README.md +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/lib/epic-discovery.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/lib/logger.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/next.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/next.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/optimize.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/pr-create.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/pr-list.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/prd-list.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/prd-list.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/prd-new.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/prd-parse.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/prd-status.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/prd-status.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/release.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/search.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/search.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/standup.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/standup.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/status.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/status.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/sync-batch.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/sync.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/template-list.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/template-new.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/validate.js +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/validate.sh +0 -0
- /package/{autopm/.claude → packages/plugin-pm}/scripts/pm/what-next.js +0 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
/*
|
|
2
|
+
dbt Transform Example - Context7 Best Practices
|
|
3
|
+
|
|
4
|
+
Demonstrates dbt transformation patterns from Context7:
|
|
5
|
+
- Jinja macros (log, debug, ref, source)
|
|
6
|
+
- Materializations (table, view, incremental)
|
|
7
|
+
- Tests and documentation
|
|
8
|
+
- Configuration blocks
|
|
9
|
+
|
|
10
|
+
Source: /dbt-labs/dbt-core (133 snippets, trust 10.0)
|
|
11
|
+
|
|
12
|
+
To use this file:
|
|
13
|
+
1. Place in models/ directory of your dbt project
|
|
14
|
+
2. Create schema.yml for tests and documentation
|
|
15
|
+
3. Run: dbt run --models fct_orders
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
-- ===================================================================
|
|
19
|
+
-- MODEL CONFIGURATION (Context7 Pattern)
|
|
20
|
+
-- ===================================================================
|
|
21
|
+
|
|
22
|
+
{{
|
|
23
|
+
config(
|
|
24
|
+
materialized='table',
|
|
25
|
+
tags=['finance', 'production'],
|
|
26
|
+
schema='analytics',
|
|
27
|
+
alias='fact_orders'
|
|
28
|
+
)
|
|
29
|
+
}}
|
|
30
|
+
|
|
31
|
+
-- ===================================================================
|
|
32
|
+
-- JINJA MACROS (Context7 Pattern)
|
|
33
|
+
-- ===================================================================
|
|
34
|
+
|
|
35
|
+
-- ✅ CORRECT: Use {{ log() }} for debugging
|
|
36
|
+
{{ log("Building fct_orders model", info=True) }}
|
|
37
|
+
|
|
38
|
+
-- ===================================================================
|
|
39
|
+
-- CTE STRUCTURE (Best Practice)
|
|
40
|
+
-- ===================================================================
|
|
41
|
+
|
|
42
|
+
WITH
|
|
43
|
+
|
|
44
|
+
-- ✅ CORRECT: Use {{ ref() }} for model dependencies
|
|
45
|
+
raw_orders AS (
|
|
46
|
+
SELECT *
|
|
47
|
+
FROM {{ ref('stg_orders') }}
|
|
48
|
+
{{ log("Loaded " ~ (select count(*) from ref('stg_orders')) ~ " orders", info=True) }}
|
|
49
|
+
),
|
|
50
|
+
|
|
51
|
+
-- ✅ CORRECT: Use {{ source() }} for raw data
|
|
52
|
+
raw_customers AS (
|
|
53
|
+
SELECT *
|
|
54
|
+
FROM {{ source('raw', 'customers') }}
|
|
55
|
+
),
|
|
56
|
+
|
|
57
|
+
-- ✅ CORRECT: Use {{ ref() }} for other models
|
|
58
|
+
raw_products AS (
|
|
59
|
+
SELECT *
|
|
60
|
+
FROM {{ ref('dim_products') }}
|
|
61
|
+
),
|
|
62
|
+
|
|
63
|
+
-- ===================================================================
|
|
64
|
+
-- TRANSFORMATIONS
|
|
65
|
+
-- ===================================================================
|
|
66
|
+
|
|
67
|
+
enriched_orders AS (
|
|
68
|
+
SELECT
|
|
69
|
+
o.order_id,
|
|
70
|
+
o.order_date,
|
|
71
|
+
o.customer_id,
|
|
72
|
+
c.customer_name,
|
|
73
|
+
c.customer_email,
|
|
74
|
+
c.customer_segment,
|
|
75
|
+
o.product_id,
|
|
76
|
+
p.product_name,
|
|
77
|
+
p.product_category,
|
|
78
|
+
o.quantity,
|
|
79
|
+
o.unit_price,
|
|
80
|
+
-- ✅ CORRECT: Calculated columns
|
|
81
|
+
o.quantity * o.unit_price AS order_total,
|
|
82
|
+
CASE
|
|
83
|
+
WHEN o.quantity > 10 THEN 'bulk'
|
|
84
|
+
WHEN o.quantity > 5 THEN 'medium'
|
|
85
|
+
ELSE 'small'
|
|
86
|
+
END AS order_size,
|
|
87
|
+
-- Metadata
|
|
88
|
+
CURRENT_TIMESTAMP AS dbt_updated_at,
|
|
89
|
+
'{{ run_started_at }}' AS dbt_run_started_at
|
|
90
|
+
|
|
91
|
+
FROM raw_orders o
|
|
92
|
+
LEFT JOIN raw_customers c
|
|
93
|
+
ON o.customer_id = c.customer_id
|
|
94
|
+
LEFT JOIN raw_products p
|
|
95
|
+
ON o.product_id = p.product_id
|
|
96
|
+
|
|
97
|
+
-- ✅ CORRECT: Filter out invalid records
|
|
98
|
+
WHERE o.order_date IS NOT NULL
|
|
99
|
+
AND o.quantity > 0
|
|
100
|
+
AND o.unit_price > 0
|
|
101
|
+
),
|
|
102
|
+
|
|
103
|
+
-- ===================================================================
|
|
104
|
+
-- AGGREGATIONS
|
|
105
|
+
-- ===================================================================
|
|
106
|
+
|
|
107
|
+
order_metrics AS (
|
|
108
|
+
SELECT
|
|
109
|
+
order_id,
|
|
110
|
+
order_date,
|
|
111
|
+
customer_id,
|
|
112
|
+
customer_name,
|
|
113
|
+
product_id,
|
|
114
|
+
product_name,
|
|
115
|
+
order_total,
|
|
116
|
+
order_size,
|
|
117
|
+
|
|
118
|
+
-- Customer-level aggregations
|
|
119
|
+
SUM(order_total) OVER (
|
|
120
|
+
PARTITION BY customer_id
|
|
121
|
+
ORDER BY order_date
|
|
122
|
+
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW
|
|
123
|
+
) AS customer_lifetime_value,
|
|
124
|
+
|
|
125
|
+
-- Product-level aggregations
|
|
126
|
+
AVG(order_total) OVER (
|
|
127
|
+
PARTITION BY product_id
|
|
128
|
+
) AS product_avg_order_value,
|
|
129
|
+
|
|
130
|
+
dbt_updated_at,
|
|
131
|
+
dbt_run_started_at
|
|
132
|
+
|
|
133
|
+
FROM enriched_orders
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
-- ===================================================================
|
|
137
|
+
-- FINAL SELECT
|
|
138
|
+
-- ===================================================================
|
|
139
|
+
|
|
140
|
+
SELECT
|
|
141
|
+
order_id,
|
|
142
|
+
order_date,
|
|
143
|
+
customer_id,
|
|
144
|
+
customer_name,
|
|
145
|
+
product_id,
|
|
146
|
+
product_name,
|
|
147
|
+
order_total,
|
|
148
|
+
order_size,
|
|
149
|
+
customer_lifetime_value,
|
|
150
|
+
product_avg_order_value,
|
|
151
|
+
dbt_updated_at,
|
|
152
|
+
dbt_run_started_at
|
|
153
|
+
|
|
154
|
+
FROM order_metrics
|
|
155
|
+
|
|
156
|
+
-- ===================================================================
|
|
157
|
+
-- TESTS AND DOCUMENTATION (schema.yml)
|
|
158
|
+
-- ===================================================================
|
|
159
|
+
|
|
160
|
+
/*
|
|
161
|
+
Create a schema.yml file alongside this model:
|
|
162
|
+
|
|
163
|
+
version: 2
|
|
164
|
+
|
|
165
|
+
models:
|
|
166
|
+
- name: fct_orders
|
|
167
|
+
description: "Orders fact table with customer and product enrichment"
|
|
168
|
+
|
|
169
|
+
# ✅ CORRECT: Model-level tests
|
|
170
|
+
tests:
|
|
171
|
+
- dbt_utils.unique_combination_of_columns:
|
|
172
|
+
combination_of_columns:
|
|
173
|
+
- order_id
|
|
174
|
+
|
|
175
|
+
columns:
|
|
176
|
+
- name: order_id
|
|
177
|
+
description: "Primary key - unique order identifier"
|
|
178
|
+
tests:
|
|
179
|
+
- unique
|
|
180
|
+
- not_null
|
|
181
|
+
|
|
182
|
+
- name: customer_id
|
|
183
|
+
description: "Foreign key to customers dimension"
|
|
184
|
+
tests:
|
|
185
|
+
- not_null
|
|
186
|
+
- relationships:
|
|
187
|
+
to: ref('dim_customers')
|
|
188
|
+
field: customer_id
|
|
189
|
+
|
|
190
|
+
- name: order_date
|
|
191
|
+
description: "Order creation timestamp"
|
|
192
|
+
tests:
|
|
193
|
+
- not_null
|
|
194
|
+
- dbt_utils.expression_is_true:
|
|
195
|
+
expression: "order_date <= current_date"
|
|
196
|
+
|
|
197
|
+
- name: order_total
|
|
198
|
+
description: "Total order amount (quantity * unit_price)"
|
|
199
|
+
tests:
|
|
200
|
+
- not_null
|
|
201
|
+
- dbt_utils.accepted_range:
|
|
202
|
+
min_value: 0
|
|
203
|
+
inclusive: true
|
|
204
|
+
|
|
205
|
+
- name: customer_lifetime_value
|
|
206
|
+
description: "Cumulative customer spending"
|
|
207
|
+
tests:
|
|
208
|
+
- not_null
|
|
209
|
+
- dbt_utils.accepted_range:
|
|
210
|
+
min_value: 0
|
|
211
|
+
|
|
212
|
+
sources:
|
|
213
|
+
- name: raw
|
|
214
|
+
description: "Raw data from source systems"
|
|
215
|
+
tables:
|
|
216
|
+
- name: customers
|
|
217
|
+
description: "Customer master data"
|
|
218
|
+
columns:
|
|
219
|
+
- name: customer_id
|
|
220
|
+
tests:
|
|
221
|
+
- unique
|
|
222
|
+
- not_null
|
|
223
|
+
|
|
224
|
+
Context7 Patterns Demonstrated:
|
|
225
|
+
================================
|
|
226
|
+
1. ✅ {{ config() }} - Model configuration
|
|
227
|
+
2. ✅ {{ ref() }} - Reference other models
|
|
228
|
+
3. ✅ {{ source() }} - Reference raw data sources
|
|
229
|
+
4. ✅ {{ log() }} - Debug logging
|
|
230
|
+
5. ✅ CTE structure - Clean, readable SQL
|
|
231
|
+
6. ✅ Calculated columns - Business logic
|
|
232
|
+
7. ✅ Window functions - Advanced aggregations
|
|
233
|
+
8. ✅ Tests in schema.yml - Data quality
|
|
234
|
+
9. ✅ Documentation - Column descriptions
|
|
235
|
+
10. ✅ Relationships - Foreign key tests
|
|
236
|
+
|
|
237
|
+
Source: /dbt-labs/dbt-core (133 snippets, trust 10.0)
|
|
238
|
+
*/
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Kafka Streaming Example - Context7 Best Practices
|
|
4
|
+
|
|
5
|
+
Demonstrates Kafka producer/consumer patterns from Context7:
|
|
6
|
+
- Producer with proper configuration and callbacks
|
|
7
|
+
- Consumer with manual commits
|
|
8
|
+
- Error handling and retry logic
|
|
9
|
+
- Graceful shutdown
|
|
10
|
+
|
|
11
|
+
Source: /apache/kafka (1,281 snippets, trust 9.1)
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from kafka import KafkaProducer, KafkaConsumer
|
|
15
|
+
from kafka.errors import KafkaError
|
|
16
|
+
import json
|
|
17
|
+
import logging
|
|
18
|
+
from datetime import datetime
|
|
19
|
+
import time
|
|
20
|
+
import signal
|
|
21
|
+
import sys
|
|
22
|
+
|
|
23
|
+
logging.basicConfig(level=logging.INFO)
|
|
24
|
+
logger = logging.getLogger(__name__)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
# ===================================================================
|
|
28
|
+
# PRODUCER EXAMPLE
|
|
29
|
+
# ===================================================================
|
|
30
|
+
|
|
31
|
+
class EventProducer:
|
|
32
|
+
"""
|
|
33
|
+
Kafka producer with Context7 best practices.
|
|
34
|
+
|
|
35
|
+
Context7 Patterns:
|
|
36
|
+
- acks='all' for reliability
|
|
37
|
+
- Compression for performance
|
|
38
|
+
- Callbacks for delivery confirmation
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
def __init__(
|
|
42
|
+
self,
|
|
43
|
+
bootstrap_servers: str = "localhost:9092",
|
|
44
|
+
topic: str = "user_events",
|
|
45
|
+
):
|
|
46
|
+
self.topic = topic
|
|
47
|
+
|
|
48
|
+
# ✅ CORRECT: Producer with proper configuration
|
|
49
|
+
self.producer = KafkaProducer(
|
|
50
|
+
bootstrap_servers=bootstrap_servers,
|
|
51
|
+
# Serialization
|
|
52
|
+
value_serializer=lambda v: json.dumps(v).encode('utf-8'),
|
|
53
|
+
key_serializer=lambda k: k.encode('utf-8') if k else None,
|
|
54
|
+
# Reliability
|
|
55
|
+
acks='all', # Wait for all replicas
|
|
56
|
+
retries=3,
|
|
57
|
+
max_in_flight_requests_per_connection=1,
|
|
58
|
+
# Performance
|
|
59
|
+
compression_type='snappy',
|
|
60
|
+
batch_size=16384,
|
|
61
|
+
linger_ms=10,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
logger.info(f"Producer initialized for topic: {self.topic}")
|
|
65
|
+
|
|
66
|
+
def send_event(self, key: str, value: dict) -> None:
|
|
67
|
+
"""
|
|
68
|
+
Send event with Context7 callback pattern.
|
|
69
|
+
|
|
70
|
+
Context7 Pattern: Async send with delivery confirmation
|
|
71
|
+
"""
|
|
72
|
+
value["timestamp"] = datetime.utcnow().isoformat()
|
|
73
|
+
|
|
74
|
+
future = self.producer.send(self.topic, key=key, value=value)
|
|
75
|
+
future.add_callback(self._on_success)
|
|
76
|
+
future.add_errback(self._on_error)
|
|
77
|
+
|
|
78
|
+
def _on_success(self, record_metadata):
|
|
79
|
+
"""Callback for successful delivery."""
|
|
80
|
+
logger.info(
|
|
81
|
+
f"✓ Message delivered: topic={record_metadata.topic}, "
|
|
82
|
+
f"partition={record_metadata.partition}, offset={record_metadata.offset}"
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
def _on_error(self, excp):
|
|
86
|
+
"""Callback for delivery failure."""
|
|
87
|
+
logger.error(f"✗ Message delivery failed: {excp}")
|
|
88
|
+
|
|
89
|
+
def close(self):
|
|
90
|
+
"""Close producer after flushing."""
|
|
91
|
+
logger.info("Flushing and closing producer...")
|
|
92
|
+
self.producer.flush()
|
|
93
|
+
self.producer.close()
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
# ===================================================================
|
|
97
|
+
# CONSUMER EXAMPLE
|
|
98
|
+
# ===================================================================
|
|
99
|
+
|
|
100
|
+
class EventConsumer:
|
|
101
|
+
"""
|
|
102
|
+
Kafka consumer with Context7 best practices.
|
|
103
|
+
|
|
104
|
+
Context7 Patterns:
|
|
105
|
+
- Manual commits for reliability
|
|
106
|
+
- Proper configuration (consumer.* prefix)
|
|
107
|
+
- Graceful shutdown
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
def __init__(
|
|
111
|
+
self,
|
|
112
|
+
bootstrap_servers: str = "localhost:9092",
|
|
113
|
+
topic: str = "user_events",
|
|
114
|
+
group_id: str = "event_processor_group",
|
|
115
|
+
):
|
|
116
|
+
self.topic = topic
|
|
117
|
+
self.running = True
|
|
118
|
+
|
|
119
|
+
# ✅ CORRECT: Consumer with proper configuration
|
|
120
|
+
self.consumer = KafkaConsumer(
|
|
121
|
+
topic,
|
|
122
|
+
bootstrap_servers=bootstrap_servers,
|
|
123
|
+
group_id=group_id,
|
|
124
|
+
# Deserialization
|
|
125
|
+
value_deserializer=lambda m: json.loads(m.decode('utf-8')),
|
|
126
|
+
key_deserializer=lambda k: k.decode('utf-8') if k else None,
|
|
127
|
+
# Commit strategy
|
|
128
|
+
enable_auto_commit=False, # Manual commits
|
|
129
|
+
auto_offset_reset='earliest',
|
|
130
|
+
# Performance
|
|
131
|
+
max_poll_records=100,
|
|
132
|
+
max_poll_interval_ms=300000,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Setup graceful shutdown
|
|
136
|
+
signal.signal(signal.SIGINT, self._shutdown)
|
|
137
|
+
signal.signal(signal.SIGTERM, self._shutdown)
|
|
138
|
+
|
|
139
|
+
logger.info(f"Consumer initialized: topic={self.topic}, group={group_id}")
|
|
140
|
+
|
|
141
|
+
def consume(self) -> None:
|
|
142
|
+
"""
|
|
143
|
+
Consume messages with Context7 manual commit pattern.
|
|
144
|
+
|
|
145
|
+
Context7 Pattern: Process then commit for exactly-once semantics
|
|
146
|
+
"""
|
|
147
|
+
try:
|
|
148
|
+
while self.running:
|
|
149
|
+
# Context7 Pattern: Poll with timeout
|
|
150
|
+
messages = self.consumer.poll(timeout_ms=1000)
|
|
151
|
+
|
|
152
|
+
if not messages:
|
|
153
|
+
continue
|
|
154
|
+
|
|
155
|
+
for topic_partition, records in messages.items():
|
|
156
|
+
for record in records:
|
|
157
|
+
try:
|
|
158
|
+
# Process message
|
|
159
|
+
self._process_message(record)
|
|
160
|
+
|
|
161
|
+
# ✅ CORRECT: Commit after successful processing
|
|
162
|
+
self.consumer.commit()
|
|
163
|
+
|
|
164
|
+
except Exception as e:
|
|
165
|
+
logger.error(f"Error processing message: {e}")
|
|
166
|
+
# In production: decide to skip or retry
|
|
167
|
+
|
|
168
|
+
finally:
|
|
169
|
+
self._close()
|
|
170
|
+
|
|
171
|
+
def _process_message(self, record) -> None:
|
|
172
|
+
"""Process a single message."""
|
|
173
|
+
logger.info(
|
|
174
|
+
f"Processing: partition={record.partition}, "
|
|
175
|
+
f"offset={record.offset}, key={record.key}"
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
# Your business logic here
|
|
179
|
+
logger.info(f"Message: {record.value}")
|
|
180
|
+
|
|
181
|
+
def _shutdown(self, signum, frame):
|
|
182
|
+
"""Handle shutdown signal."""
|
|
183
|
+
logger.info("Shutdown signal received")
|
|
184
|
+
self.running = False
|
|
185
|
+
|
|
186
|
+
def _close(self):
|
|
187
|
+
"""Close consumer."""
|
|
188
|
+
logger.info("Closing consumer...")
|
|
189
|
+
self.consumer.close()
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
# ===================================================================
|
|
193
|
+
# DEMO APPLICATION
|
|
194
|
+
# ===================================================================
|
|
195
|
+
|
|
196
|
+
def demo_producer():
|
|
197
|
+
"""Demonstrate producer patterns."""
|
|
198
|
+
print("\n" + "=" * 60)
|
|
199
|
+
print("PRODUCER DEMO - Context7 Patterns")
|
|
200
|
+
print("=" * 60)
|
|
201
|
+
|
|
202
|
+
producer = EventProducer()
|
|
203
|
+
|
|
204
|
+
try:
|
|
205
|
+
# Send 10 events
|
|
206
|
+
for i in range(10):
|
|
207
|
+
event = {
|
|
208
|
+
"event_id": i,
|
|
209
|
+
"event_type": "page_view",
|
|
210
|
+
"user_id": f"user_{i % 3}",
|
|
211
|
+
"page": f"/page/{i}",
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
producer.send_event(key=f"user_{i % 3}", value=event)
|
|
215
|
+
time.sleep(0.1)
|
|
216
|
+
|
|
217
|
+
logger.info("All events sent")
|
|
218
|
+
|
|
219
|
+
finally:
|
|
220
|
+
producer.close()
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
def demo_consumer():
|
|
224
|
+
"""Demonstrate consumer patterns."""
|
|
225
|
+
print("\n" + "=" * 60)
|
|
226
|
+
print("CONSUMER DEMO - Context7 Patterns")
|
|
227
|
+
print("=" * 60)
|
|
228
|
+
print("Press Ctrl+C to stop consuming...")
|
|
229
|
+
|
|
230
|
+
consumer = EventConsumer()
|
|
231
|
+
consumer.consume()
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
if __name__ == "__main__":
|
|
235
|
+
print("Kafka Streaming Example - Context7 Best Practices")
|
|
236
|
+
print("=" * 60)
|
|
237
|
+
print("")
|
|
238
|
+
print("Context7 Patterns Demonstrated:")
|
|
239
|
+
print("1. ✅ Producer: acks='all' for reliability")
|
|
240
|
+
print("2. ✅ Producer: Callbacks for delivery confirmation")
|
|
241
|
+
print("3. ✅ Producer: Compression and batching")
|
|
242
|
+
print("4. ✅ Consumer: Manual commits for exactly-once")
|
|
243
|
+
print("5. ✅ Consumer: Proper error handling")
|
|
244
|
+
print("6. ✅ Consumer: Graceful shutdown")
|
|
245
|
+
print("7. ✅ Serialization: JSON with proper encoding")
|
|
246
|
+
print("")
|
|
247
|
+
print("Source: /apache/kafka (1,281 snippets, trust 9.1)")
|
|
248
|
+
print("")
|
|
249
|
+
|
|
250
|
+
mode = input("Run (p)roducer or (c)onsumer? [p/c]: ").strip().lower()
|
|
251
|
+
|
|
252
|
+
if mode == 'p':
|
|
253
|
+
demo_producer()
|
|
254
|
+
elif mode == 'c':
|
|
255
|
+
demo_consumer()
|
|
256
|
+
else:
|
|
257
|
+
print("Invalid choice. Use 'p' or 'c'")
|