specweave 0.18.1 ā 0.20.1
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/CLAUDE.md +229 -1817
- package/README.md +68 -0
- package/bin/specweave.js +62 -6
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +1 -1
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +3 -0
- package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +1 -1
- package/dist/plugins/specweave/lib/hooks/update-ac-status.d.ts +21 -0
- package/dist/plugins/specweave/lib/hooks/update-ac-status.d.ts.map +1 -0
- package/dist/plugins/specweave/lib/hooks/update-ac-status.js +162 -0
- package/dist/plugins/specweave/lib/hooks/update-ac-status.js.map +1 -0
- package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.js +65 -6
- package/dist/plugins/specweave-ado/lib/ado-spec-content-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/completion-calculator.d.ts +112 -0
- package/dist/plugins/specweave-github/lib/completion-calculator.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/completion-calculator.js +301 -0
- package/dist/plugins/specweave-github/lib/completion-calculator.js.map +1 -0
- package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts +3 -3
- package/dist/plugins/specweave-github/lib/duplicate-detector.js +3 -3
- package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts +7 -0
- package/dist/plugins/specweave-github/lib/epic-content-builder.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/epic-content-builder.js +42 -0
- package/dist/plugins/specweave-github/lib/epic-content-builder.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +14 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-client-v2.js +51 -0
- package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.js +1 -1
- package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts +87 -0
- package/dist/plugins/specweave-github/lib/github-feature-sync.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/github-feature-sync.js +412 -0
- package/dist/plugins/specweave-github/lib/github-feature-sync.js.map +1 -0
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js +64 -13
- package/dist/plugins/specweave-github/lib/github-spec-content-sync.js.map +1 -1
- package/dist/plugins/specweave-github/lib/progress-comment-builder.d.ts +78 -0
- package/dist/plugins/specweave-github/lib/progress-comment-builder.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/progress-comment-builder.js +237 -0
- package/dist/plugins/specweave-github/lib/progress-comment-builder.js.map +1 -0
- package/dist/plugins/specweave-github/lib/user-story-content-builder.d.ts +97 -0
- package/dist/plugins/specweave-github/lib/user-story-content-builder.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/user-story-content-builder.js +301 -0
- package/dist/plugins/specweave-github/lib/user-story-content-builder.js.map +1 -0
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts +83 -0
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.d.ts.map +1 -0
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.js +386 -0
- package/dist/plugins/specweave-github/lib/user-story-issue-builder.js.map +1 -0
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts +8 -6
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.d.ts.map +1 -1
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js +78 -117
- package/dist/plugins/specweave-jira/lib/enhanced-jira-sync.js.map +1 -1
- package/dist/src/cli/commands/import-docs.js +4 -4
- package/dist/src/cli/commands/import-docs.js.map +1 -1
- package/dist/src/cli/commands/init-multiproject.d.ts.map +1 -1
- package/dist/src/cli/commands/init-multiproject.js +17 -18
- package/dist/src/cli/commands/init-multiproject.js.map +1 -1
- package/dist/src/cli/commands/migrate-to-multiproject.d.ts.map +1 -1
- package/dist/src/cli/commands/migrate-to-multiproject.js +8 -4
- package/dist/src/cli/commands/migrate-to-multiproject.js.map +1 -1
- package/dist/src/cli/commands/switch-project.d.ts.map +1 -1
- package/dist/src/cli/commands/switch-project.js +9 -26
- package/dist/src/cli/commands/switch-project.js.map +1 -1
- package/dist/src/cli/commands/sync-spec-content.js +3 -0
- package/dist/src/cli/commands/sync-spec-content.js.map +1 -1
- package/dist/src/core/deduplication/command-deduplicator.d.ts +166 -0
- package/dist/src/core/deduplication/command-deduplicator.d.ts.map +1 -0
- package/dist/src/core/deduplication/command-deduplicator.js +254 -0
- package/dist/src/core/deduplication/command-deduplicator.js.map +1 -0
- package/dist/src/core/increment/active-increment-manager.d.ts +42 -15
- package/dist/src/core/increment/active-increment-manager.d.ts.map +1 -1
- package/dist/src/core/increment/active-increment-manager.js +113 -46
- package/dist/src/core/increment/active-increment-manager.js.map +1 -1
- package/dist/src/core/increment/conflict-resolver.d.ts +40 -0
- package/dist/src/core/increment/conflict-resolver.d.ts.map +1 -0
- package/dist/src/core/increment/conflict-resolver.js +219 -0
- package/dist/src/core/increment/conflict-resolver.js.map +1 -0
- package/dist/src/core/increment/discipline-checker.d.ts.map +1 -1
- package/dist/src/core/increment/discipline-checker.js +7 -1
- package/dist/src/core/increment/discipline-checker.js.map +1 -1
- package/dist/src/core/increment/duplicate-detector.d.ts +52 -0
- package/dist/src/core/increment/duplicate-detector.d.ts.map +1 -0
- package/dist/src/core/increment/duplicate-detector.js +276 -0
- package/dist/src/core/increment/duplicate-detector.js.map +1 -0
- package/dist/src/core/increment/increment-archiver.d.ts +90 -0
- package/dist/src/core/increment/increment-archiver.d.ts.map +1 -0
- package/dist/src/core/increment/increment-archiver.js +368 -0
- package/dist/src/core/increment/increment-archiver.js.map +1 -0
- package/dist/src/core/increment/increment-reopener.d.ts +165 -0
- package/dist/src/core/increment/increment-reopener.d.ts.map +1 -0
- package/dist/src/core/increment/increment-reopener.js +390 -0
- package/dist/src/core/increment/increment-reopener.js.map +1 -0
- package/dist/src/core/increment/metadata-manager.d.ts +26 -1
- package/dist/src/core/increment/metadata-manager.d.ts.map +1 -1
- package/dist/src/core/increment/metadata-manager.js +143 -5
- package/dist/src/core/increment/metadata-manager.js.map +1 -1
- package/dist/src/core/increment/recent-work-scanner.d.ts +121 -0
- package/dist/src/core/increment/recent-work-scanner.d.ts.map +1 -0
- package/dist/src/core/increment/recent-work-scanner.js +303 -0
- package/dist/src/core/increment/recent-work-scanner.js.map +1 -0
- package/dist/src/core/increment/types.d.ts +1 -0
- package/dist/src/core/increment/types.d.ts.map +1 -1
- package/dist/src/core/increment-utils.d.ts +112 -0
- package/dist/src/core/increment-utils.d.ts.map +1 -0
- package/dist/src/core/increment-utils.js +210 -0
- package/dist/src/core/increment-utils.js.map +1 -0
- package/dist/src/core/living-docs/ac-project-specific-generator.d.ts +65 -0
- package/dist/src/core/living-docs/ac-project-specific-generator.d.ts.map +1 -0
- package/dist/src/core/living-docs/ac-project-specific-generator.js +175 -0
- package/dist/src/core/living-docs/ac-project-specific-generator.js.map +1 -0
- package/dist/src/core/living-docs/feature-archiver.d.ts +130 -0
- package/dist/src/core/living-docs/feature-archiver.d.ts.map +1 -0
- package/dist/src/core/living-docs/feature-archiver.js +549 -0
- package/dist/src/core/living-docs/feature-archiver.js.map +1 -0
- package/dist/src/core/living-docs/feature-id-manager.d.ts +81 -0
- package/dist/src/core/living-docs/feature-id-manager.d.ts.map +1 -0
- package/dist/src/core/living-docs/feature-id-manager.js +339 -0
- package/dist/src/core/living-docs/feature-id-manager.js.map +1 -0
- package/dist/src/core/living-docs/hierarchy-mapper.d.ts +144 -83
- package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -1
- package/dist/src/core/living-docs/hierarchy-mapper.js +488 -270
- package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -1
- package/dist/src/core/living-docs/index.d.ts +6 -0
- package/dist/src/core/living-docs/index.d.ts.map +1 -1
- package/dist/src/core/living-docs/index.js +6 -0
- package/dist/src/core/living-docs/index.js.map +1 -1
- package/dist/src/core/living-docs/project-detector.d.ts +6 -0
- package/dist/src/core/living-docs/project-detector.d.ts.map +1 -1
- package/dist/src/core/living-docs/project-detector.js +35 -1
- package/dist/src/core/living-docs/project-detector.js.map +1 -1
- package/dist/src/core/living-docs/spec-distributor.d.ts +100 -26
- package/dist/src/core/living-docs/spec-distributor.d.ts.map +1 -1
- package/dist/src/core/living-docs/spec-distributor.js +1275 -258
- package/dist/src/core/living-docs/spec-distributor.js.map +1 -1
- package/dist/src/core/living-docs/task-project-specific-generator.d.ts +109 -0
- package/dist/src/core/living-docs/task-project-specific-generator.d.ts.map +1 -0
- package/dist/src/core/living-docs/task-project-specific-generator.js +221 -0
- package/dist/src/core/living-docs/task-project-specific-generator.js.map +1 -0
- package/dist/src/core/living-docs/types.d.ts +143 -0
- package/dist/src/core/living-docs/types.d.ts.map +1 -1
- package/dist/src/core/project-manager.d.ts +2 -17
- package/dist/src/core/project-manager.d.ts.map +1 -1
- package/dist/src/core/project-manager.js +68 -48
- package/dist/src/core/project-manager.js.map +1 -1
- package/dist/src/core/spec-content-sync.d.ts +1 -1
- package/dist/src/core/spec-content-sync.d.ts.map +1 -1
- package/dist/src/core/sync/enhanced-content-builder.d.ts.map +1 -1
- package/dist/src/core/sync/enhanced-content-builder.js +2 -1
- package/dist/src/core/sync/enhanced-content-builder.js.map +1 -1
- package/dist/src/core/sync/performance-optimizer.d.ts +153 -0
- package/dist/src/core/sync/performance-optimizer.d.ts.map +1 -0
- package/dist/src/core/sync/performance-optimizer.js +220 -0
- package/dist/src/core/sync/performance-optimizer.js.map +1 -0
- package/dist/src/core/sync/retry-handler.d.ts +98 -0
- package/dist/src/core/sync/retry-handler.d.ts.map +1 -0
- package/dist/src/core/sync/retry-handler.js +196 -0
- package/dist/src/core/sync/retry-handler.js.map +1 -0
- package/dist/src/core/types/config.d.ts +94 -0
- package/dist/src/core/types/config.d.ts.map +1 -1
- package/dist/src/core/types/config.js +16 -0
- package/dist/src/core/types/config.js.map +1 -1
- package/dist/src/core/types/increment-metadata.d.ts +6 -0
- package/dist/src/core/types/increment-metadata.d.ts.map +1 -1
- package/dist/src/core/types/increment-metadata.js +10 -1
- package/dist/src/core/types/increment-metadata.js.map +1 -1
- package/dist/src/integrations/jira/jira-incremental-mapper.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-incremental-mapper.js +4 -8
- package/dist/src/integrations/jira/jira-incremental-mapper.js.map +1 -1
- package/dist/src/integrations/jira/jira-mapper.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-mapper.js +4 -8
- package/dist/src/integrations/jira/jira-mapper.js.map +1 -1
- package/package.json +1 -1
- package/plugins/specweave/COMMANDS.md +13 -4
- package/plugins/specweave/commands/specweave-abandon.md +22 -20
- package/plugins/specweave/commands/specweave-archive-features.md +121 -0
- package/plugins/specweave/commands/specweave-archive-increments.md +82 -0
- package/plugins/specweave/commands/specweave-archive.md +363 -0
- package/plugins/specweave/commands/specweave-backlog.md +211 -0
- package/plugins/specweave/commands/specweave-fix-duplicates.md +517 -0
- package/plugins/specweave/commands/specweave-increment.md +4 -3
- package/plugins/specweave/commands/specweave-progress.md +176 -27
- package/plugins/specweave/commands/specweave-reopen.md +391 -0
- package/plugins/specweave/commands/specweave-restore-feature.md +90 -0
- package/plugins/specweave/commands/specweave-restore.md +309 -0
- package/plugins/specweave/commands/specweave-resume.md +51 -23
- package/plugins/specweave/commands/specweave-status.md +41 -7
- package/plugins/specweave/commands/specweave-sync-specs.md +425 -0
- package/plugins/specweave/hooks/hooks.json +4 -0
- package/plugins/specweave/hooks/lib/sync-spec-content.sh +2 -2
- package/plugins/specweave/hooks/post-task-completion.sh +39 -0
- package/plugins/specweave/hooks/pre-command-deduplication.sh +83 -0
- package/plugins/specweave/hooks/user-prompt-submit.sh +1 -1
- package/plugins/specweave/lib/hooks/sync-living-docs.js +2 -0
- package/plugins/specweave/lib/hooks/sync-living-docs.ts +4 -0
- package/plugins/specweave/lib/hooks/update-ac-status.js +102 -0
- package/plugins/specweave/lib/hooks/update-ac-status.ts +192 -0
- package/plugins/specweave/skills/archive-increments/SKILL.md +198 -0
- package/plugins/specweave/skills/increment-planner/scripts/feature-utils.js +14 -0
- package/plugins/specweave/skills/smart-reopen-detector/SKILL.md +244 -0
- package/plugins/specweave-ado/lib/ado-spec-content-sync.js +49 -5
- package/plugins/specweave-ado/lib/ado-spec-content-sync.ts +72 -6
- package/plugins/specweave-confluent/.claude-plugin/plugin.json +23 -0
- package/plugins/specweave-confluent/README.md +375 -0
- package/plugins/specweave-confluent/agents/confluent-architect/AGENT.md +306 -0
- package/plugins/specweave-confluent/skills/confluent-kafka-connect/SKILL.md +453 -0
- package/plugins/specweave-confluent/skills/confluent-ksqldb/SKILL.md +470 -0
- package/plugins/specweave-confluent/skills/confluent-schema-registry/SKILL.md +316 -0
- package/plugins/specweave-github/agents/github-task-splitter/AGENT.md +2 -2
- package/plugins/specweave-github/agents/user-story-updater/AGENT.md +148 -0
- package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +1 -1
- package/plugins/specweave-github/commands/specweave-github-update-user-story.md +156 -0
- package/plugins/specweave-github/hooks/post-task-completion.sh +10 -9
- package/plugins/specweave-github/lib/completion-calculator.js +262 -0
- package/plugins/specweave-github/lib/completion-calculator.ts +434 -0
- package/plugins/specweave-github/lib/duplicate-detector.js +3 -3
- package/plugins/specweave-github/lib/duplicate-detector.ts +4 -4
- package/plugins/specweave-github/lib/epic-content-builder.js +38 -0
- package/plugins/specweave-github/lib/epic-content-builder.ts +59 -0
- package/plugins/specweave-github/lib/github-client-v2.js +49 -0
- package/plugins/specweave-github/lib/github-client-v2.ts +59 -0
- package/plugins/specweave-github/lib/github-epic-sync.ts +1 -1
- package/plugins/specweave-github/lib/github-feature-sync.js +381 -0
- package/plugins/specweave-github/lib/github-feature-sync.ts +568 -0
- package/plugins/specweave-github/lib/github-spec-content-sync.js +40 -10
- package/plugins/specweave-github/lib/github-spec-content-sync.ts +82 -14
- package/plugins/specweave-github/lib/progress-comment-builder.js +229 -0
- package/plugins/specweave-github/lib/progress-comment-builder.ts +324 -0
- package/plugins/specweave-github/lib/user-story-content-builder.js +299 -0
- package/plugins/specweave-github/lib/user-story-content-builder.ts +413 -0
- package/plugins/specweave-github/lib/user-story-issue-builder.js +344 -0
- package/plugins/specweave-github/lib/user-story-issue-builder.ts +543 -0
- package/plugins/specweave-github/skills/github-issue-standard/SKILL.md +189 -0
- package/plugins/{specweave-ado/lib/enhanced-ado-sync.js ā specweave-jira/lib/enhanced-jira-sync.js} +25 -61
- package/plugins/specweave-jira/lib/{enhanced-jira-sync.ts.disabled ā enhanced-jira-sync.ts} +26 -52
- package/plugins/specweave-kafka/.claude-plugin/plugin.json +26 -0
- package/plugins/specweave-kafka/IMPLEMENTATION-COMPLETE.md +483 -0
- package/plugins/specweave-kafka/README.md +242 -0
- package/plugins/specweave-kafka/agents/kafka-architect/AGENT.md +235 -0
- package/plugins/specweave-kafka/agents/kafka-devops/AGENT.md +209 -0
- package/plugins/specweave-kafka/agents/kafka-observability/AGENT.md +266 -0
- package/plugins/specweave-kafka/commands/deploy.md +99 -0
- package/plugins/specweave-kafka/commands/dev-env.md +176 -0
- package/plugins/specweave-kafka/commands/mcp-configure.md +101 -0
- package/plugins/specweave-kafka/commands/monitor-setup.md +96 -0
- package/plugins/specweave-kafka/docker/kafka-local/docker-compose.yml +187 -0
- package/plugins/specweave-kafka/docker/redpanda/docker-compose.yml +199 -0
- package/plugins/specweave-kafka/docker/templates/consumer-nodejs.js +225 -0
- package/plugins/specweave-kafka/docker/templates/consumer-python.py +220 -0
- package/plugins/specweave-kafka/docker/templates/producer-nodejs.js +168 -0
- package/plugins/specweave-kafka/docker/templates/producer-python.py +167 -0
- package/plugins/specweave-kafka/lib/adapters/apache-kafka-adapter.js +438 -0
- package/plugins/specweave-kafka/lib/adapters/apache-kafka-adapter.ts +541 -0
- package/plugins/specweave-kafka/lib/adapters/platform-adapter.js +47 -0
- package/plugins/specweave-kafka/lib/adapters/platform-adapter.ts +343 -0
- package/plugins/specweave-kafka/lib/cli/kcat-wrapper.js +258 -0
- package/plugins/specweave-kafka/lib/cli/kcat-wrapper.ts +298 -0
- package/plugins/specweave-kafka/lib/cli/types.js +10 -0
- package/plugins/specweave-kafka/lib/cli/types.ts +92 -0
- package/plugins/specweave-kafka/lib/connectors/connector-catalog.js +305 -0
- package/plugins/specweave-kafka/lib/connectors/connector-catalog.ts +528 -0
- package/plugins/specweave-kafka/lib/documentation/diagram-generator.js +114 -0
- package/plugins/specweave-kafka/lib/documentation/diagram-generator.ts +195 -0
- package/plugins/specweave-kafka/lib/documentation/exporter.js +210 -0
- package/plugins/specweave-kafka/lib/documentation/exporter.ts +338 -0
- package/plugins/specweave-kafka/lib/documentation/schema-catalog-generator.js +60 -0
- package/plugins/specweave-kafka/lib/documentation/schema-catalog-generator.ts +130 -0
- package/plugins/specweave-kafka/lib/documentation/topology-generator.js +143 -0
- package/plugins/specweave-kafka/lib/documentation/topology-generator.ts +290 -0
- package/plugins/specweave-kafka/lib/mcp/detector.js +298 -0
- package/plugins/specweave-kafka/lib/mcp/detector.ts +352 -0
- package/plugins/specweave-kafka/lib/mcp/types.js +21 -0
- package/plugins/specweave-kafka/lib/mcp/types.ts +77 -0
- package/plugins/specweave-kafka/lib/multi-cluster/cluster-config-manager.js +193 -0
- package/plugins/specweave-kafka/lib/multi-cluster/cluster-config-manager.ts +362 -0
- package/plugins/specweave-kafka/lib/multi-cluster/cluster-switcher.js +188 -0
- package/plugins/specweave-kafka/lib/multi-cluster/cluster-switcher.ts +359 -0
- package/plugins/specweave-kafka/lib/multi-cluster/health-aggregator.js +195 -0
- package/plugins/specweave-kafka/lib/multi-cluster/health-aggregator.ts +380 -0
- package/plugins/specweave-kafka/lib/observability/opentelemetry-kafka.js +209 -0
- package/plugins/specweave-kafka/lib/observability/opentelemetry-kafka.ts +358 -0
- package/plugins/specweave-kafka/lib/patterns/advanced-ksqldb-patterns.js +354 -0
- package/plugins/specweave-kafka/lib/patterns/advanced-ksqldb-patterns.ts +563 -0
- package/plugins/specweave-kafka/lib/patterns/circuit-breaker-resilience.js +259 -0
- package/plugins/specweave-kafka/lib/patterns/circuit-breaker-resilience.ts +516 -0
- package/plugins/specweave-kafka/lib/patterns/dead-letter-queue.js +233 -0
- package/plugins/specweave-kafka/lib/patterns/dead-letter-queue.ts +423 -0
- package/plugins/specweave-kafka/lib/patterns/exactly-once-semantics.js +266 -0
- package/plugins/specweave-kafka/lib/patterns/exactly-once-semantics.ts +445 -0
- package/plugins/specweave-kafka/lib/patterns/flink-kafka-integration.js +312 -0
- package/plugins/specweave-kafka/lib/patterns/flink-kafka-integration.ts +561 -0
- package/plugins/specweave-kafka/lib/patterns/multi-dc-replication.js +289 -0
- package/plugins/specweave-kafka/lib/patterns/multi-dc-replication.ts +607 -0
- package/plugins/specweave-kafka/lib/patterns/rate-limiting-backpressure.js +264 -0
- package/plugins/specweave-kafka/lib/patterns/rate-limiting-backpressure.ts +498 -0
- package/plugins/specweave-kafka/lib/patterns/stream-processing-optimization.js +263 -0
- package/plugins/specweave-kafka/lib/patterns/stream-processing-optimization.ts +549 -0
- package/plugins/specweave-kafka/lib/patterns/tiered-storage-compaction.js +205 -0
- package/plugins/specweave-kafka/lib/patterns/tiered-storage-compaction.ts +399 -0
- package/plugins/specweave-kafka/lib/performance/performance-optimizer.js +249 -0
- package/plugins/specweave-kafka/lib/performance/performance-optimizer.ts +427 -0
- package/plugins/specweave-kafka/lib/security/kafka-security.js +252 -0
- package/plugins/specweave-kafka/lib/security/kafka-security.ts +494 -0
- package/plugins/specweave-kafka/lib/utils/capacity-planner.js +203 -0
- package/plugins/specweave-kafka/lib/utils/capacity-planner.ts +469 -0
- package/plugins/specweave-kafka/lib/utils/config-validator.js +419 -0
- package/plugins/specweave-kafka/lib/utils/config-validator.ts +564 -0
- package/plugins/specweave-kafka/lib/utils/partitioning.js +329 -0
- package/plugins/specweave-kafka/lib/utils/partitioning.ts +473 -0
- package/plugins/specweave-kafka/lib/utils/sizing.js +221 -0
- package/plugins/specweave-kafka/lib/utils/sizing.ts +374 -0
- package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-broker-metrics.json +628 -0
- package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-cluster-overview.json +564 -0
- package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-consumer-lag.json +509 -0
- package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-jvm-metrics.json +674 -0
- package/plugins/specweave-kafka/monitoring/grafana/dashboards/kafka-topic-metrics.json +578 -0
- package/plugins/specweave-kafka/monitoring/grafana/provisioning/dashboards/kafka.yml +17 -0
- package/plugins/specweave-kafka/monitoring/grafana/provisioning/datasources/prometheus.yml +17 -0
- package/plugins/specweave-kafka/monitoring/prometheus/kafka-alerts.yml +415 -0
- package/plugins/specweave-kafka/monitoring/prometheus/kafka-jmx-exporter.yml +256 -0
- package/plugins/specweave-kafka/package.json +41 -0
- package/plugins/specweave-kafka/skills/kafka-architecture/SKILL.md +647 -0
- package/plugins/specweave-kafka/skills/kafka-cli-tools/SKILL.md +433 -0
- package/plugins/specweave-kafka/skills/kafka-iac-deployment/SKILL.md +449 -0
- package/plugins/specweave-kafka/skills/kafka-kubernetes/SKILL.md +667 -0
- package/plugins/specweave-kafka/skills/kafka-mcp-integration/SKILL.md +273 -0
- package/plugins/specweave-kafka/skills/kafka-observability/SKILL.md +576 -0
- package/plugins/specweave-kafka/templates/config/broker-production.properties +254 -0
- package/plugins/specweave-kafka/templates/config/consumer-low-latency.properties +112 -0
- package/plugins/specweave-kafka/templates/config/producer-high-throughput.properties +120 -0
- package/plugins/specweave-kafka/templates/migration/mirrormaker2-config.properties +234 -0
- package/plugins/specweave-kafka/templates/monitoring/grafana/multi-cluster-dashboard.json +686 -0
- package/plugins/specweave-kafka/terraform/apache-kafka/main.tf +347 -0
- package/plugins/specweave-kafka/terraform/apache-kafka/outputs.tf +107 -0
- package/plugins/specweave-kafka/terraform/apache-kafka/templates/kafka-broker-init.sh.tpl +216 -0
- package/plugins/specweave-kafka/terraform/apache-kafka/variables.tf +156 -0
- package/plugins/specweave-kafka/terraform/aws-msk/main.tf +362 -0
- package/plugins/specweave-kafka/terraform/aws-msk/outputs.tf +93 -0
- package/plugins/specweave-kafka/terraform/aws-msk/templates/server.properties.tpl +32 -0
- package/plugins/specweave-kafka/terraform/aws-msk/variables.tf +235 -0
- package/plugins/specweave-kafka/terraform/azure-event-hubs/main.tf +281 -0
- package/plugins/specweave-kafka/terraform/azure-event-hubs/outputs.tf +118 -0
- package/plugins/specweave-kafka/terraform/azure-event-hubs/variables.tf +148 -0
- package/plugins/specweave-kafka/tsconfig.json +21 -0
- package/plugins/specweave-kafka-streams/.claude-plugin/plugin.json +23 -0
- package/plugins/specweave-kafka-streams/README.md +310 -0
- package/plugins/specweave-kafka-streams/skills/kafka-streams-topology/SKILL.md +539 -0
- package/plugins/specweave-n8n/.claude-plugin/plugin.json +22 -0
- package/plugins/specweave-n8n/README.md +354 -0
- package/plugins/specweave-n8n/skills/n8n-kafka-workflows/SKILL.md +504 -0
- package/plugins/specweave-release/commands/specweave-release-platform.md +1 -1
- package/plugins/specweave-release/hooks/post-task-completion.sh +2 -2
- package/src/templates/AGENTS.md.template +601 -7
- package/src/templates/CLAUDE.md.template +188 -88
- package/dist/locales/de/.gitkeep +0 -0
- package/dist/locales/de/cli.json +0 -108
- package/dist/locales/en/cli.json +0 -287
- package/dist/locales/en/errors.json +0 -7
- package/dist/locales/en/templates.json +0 -6
- package/dist/locales/es/.gitkeep +0 -0
- package/dist/locales/es/cli.json +0 -41
- package/dist/locales/fr/.gitkeep +0 -0
- package/dist/locales/fr/cli.json +0 -108
- package/dist/locales/ja/.gitkeep +0 -0
- package/dist/locales/ja/cli.json +0 -108
- package/dist/locales/ko/.gitkeep +0 -0
- package/dist/locales/ko/cli.json +0 -108
- package/dist/locales/pt/.gitkeep +0 -0
- package/dist/locales/pt/cli.json +0 -108
- package/dist/locales/ru/.gitkeep +0 -0
- package/dist/locales/ru/cli.json +0 -269
- package/dist/locales/zh/.gitkeep +0 -0
- package/dist/locales/zh/cli.json +0 -108
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts +0 -25
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.d.ts.map +0 -1
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js +0 -191
- package/dist/plugins/specweave-ado/lib/enhanced-ado-sync.js.map +0 -1
- package/dist/spec-parser.js +0 -629
- package/dist/src/core/sync/spec-content-sync.d.ts +0 -88
- package/dist/src/core/sync/spec-content-sync.d.ts.map +0 -1
- package/dist/src/core/sync/spec-content-sync.js +0 -5
- package/dist/src/core/sync/spec-content-sync.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/plugins/specweave-ado/commands/specweave-ado-sync-spec.md +0 -255
- package/plugins/specweave-github/commands/specweave-github-sync-epic.md +0 -248
- package/plugins/specweave-github/commands/specweave-github-sync-from.md +0 -147
- package/plugins/specweave-github/commands/specweave-github-sync-spec.md +0 -208
- package/plugins/specweave-github/commands/specweave-github-sync-tasks.md +0 -530
- package/plugins/specweave-jira/commands/specweave-jira-sync-epic.md +0 -267
- package/plugins/specweave-jira/commands/specweave-jira-sync-spec.md +0 -240
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specweave-kafka:monitor-setup
|
|
3
|
+
description: Set up comprehensive Kafka monitoring with Prometheus + Grafana. Configures JMX exporter, dashboards, and alerting rules.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Set Up Kafka Monitoring
|
|
7
|
+
|
|
8
|
+
Configure comprehensive monitoring for your Kafka cluster using Prometheus and Grafana.
|
|
9
|
+
|
|
10
|
+
## What This Command Does
|
|
11
|
+
|
|
12
|
+
1. **JMX Exporter Setup**: Configure Prometheus JMX exporter for Kafka brokers
|
|
13
|
+
2. **Prometheus Configuration**: Add Kafka scrape targets
|
|
14
|
+
3. **Grafana Dashboards**: Install 5 pre-built dashboards
|
|
15
|
+
4. **Alerting Rules**: Configure 14 critical/high/warning alerts
|
|
16
|
+
5. **Verification**: Test metrics collection and dashboard access
|
|
17
|
+
|
|
18
|
+
## Interactive Workflow
|
|
19
|
+
|
|
20
|
+
I'll detect your environment and guide setup:
|
|
21
|
+
|
|
22
|
+
### Environment Detection
|
|
23
|
+
- **Kubernetes** (Strimzi/Confluent Operator) ā Use PodMonitor
|
|
24
|
+
- **Docker Compose** ā Add Prometheus + Grafana services
|
|
25
|
+
- **VM/Bare Metal** ā Configure JMX exporter JAR
|
|
26
|
+
|
|
27
|
+
### Question 1: Where is Kafka running?
|
|
28
|
+
- Kubernetes (Strimzi)
|
|
29
|
+
- Docker Compose
|
|
30
|
+
- VMs/EC2 instances
|
|
31
|
+
|
|
32
|
+
### Question 2: Prometheus already installed?
|
|
33
|
+
- Yes ā Just add Kafka scrape config
|
|
34
|
+
- No ā Install Prometheus + Grafana stack
|
|
35
|
+
|
|
36
|
+
## Example Usage
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Start monitoring setup wizard
|
|
40
|
+
/specweave-kafka:monitor-setup
|
|
41
|
+
|
|
42
|
+
# I'll activate kafka-observability skill and:
|
|
43
|
+
# 1. Detect your environment
|
|
44
|
+
# 2. Configure JMX exporter (port 7071)
|
|
45
|
+
# 3. Set up Prometheus scraping
|
|
46
|
+
# 4. Install 5 Grafana dashboards
|
|
47
|
+
# 5. Configure 14 alerting rules
|
|
48
|
+
# 6. Verify metrics collection
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## What Gets Configured
|
|
52
|
+
|
|
53
|
+
**JMX Exporter** (Kafka brokers):
|
|
54
|
+
- Metrics endpoint on port 7071
|
|
55
|
+
- 50+ critical Kafka metrics exported
|
|
56
|
+
- Broker, topic, consumer lag, JVM metrics
|
|
57
|
+
|
|
58
|
+
**Prometheus Scraping**:
|
|
59
|
+
```yaml
|
|
60
|
+
scrape_configs:
|
|
61
|
+
- job_name: 'kafka'
|
|
62
|
+
static_configs:
|
|
63
|
+
- targets: ['kafka-0:7071', 'kafka-1:7071', 'kafka-2:7071']
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**5 Grafana Dashboards**:
|
|
67
|
+
1. **Cluster Overview** - Health, throughput, ISR changes
|
|
68
|
+
2. **Broker Metrics** - CPU, memory, network, request handlers
|
|
69
|
+
3. **Consumer Lag** - Lag per group/topic, offset tracking
|
|
70
|
+
4. **Topic Metrics** - Partition count, replication, log size
|
|
71
|
+
5. **JVM Metrics** - Heap, GC, threads, file descriptors
|
|
72
|
+
|
|
73
|
+
**14 Alerting Rules**:
|
|
74
|
+
- CRITICAL: Under-replicated partitions, offline partitions, no controller
|
|
75
|
+
- HIGH: Consumer lag, ISR shrinks, leader elections
|
|
76
|
+
- WARNING: CPU, memory, GC time, disk usage
|
|
77
|
+
|
|
78
|
+
## Prerequisites
|
|
79
|
+
|
|
80
|
+
- Kafka cluster running (self-hosted or K8s)
|
|
81
|
+
- Prometheus installed (or will be installed)
|
|
82
|
+
- Grafana installed (or will be installed)
|
|
83
|
+
|
|
84
|
+
## Post-Setup
|
|
85
|
+
|
|
86
|
+
After setup completes, I'll:
|
|
87
|
+
1. ā
Provide Grafana URL and credentials
|
|
88
|
+
2. ā
Show how to access dashboards
|
|
89
|
+
3. ā
Explain critical alerts
|
|
90
|
+
4. ā
Suggest testing alerts by stopping a broker
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
**Skills Activated**: kafka-observability
|
|
95
|
+
**Related Commands**: /specweave-kafka:deploy
|
|
96
|
+
**Dashboard Locations**: `plugins/specweave-kafka/monitoring/grafana/dashboards/`
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# Apache Kafka Local Development Environment (KRaft Mode)
|
|
2
|
+
#
|
|
3
|
+
# Single-node Kafka cluster for local testing (no ZooKeeper)
|
|
4
|
+
# Includes: Kafka, Schema Registry, Kafka UI, Prometheus, Grafana
|
|
5
|
+
|
|
6
|
+
version: '3.8'
|
|
7
|
+
|
|
8
|
+
services:
|
|
9
|
+
# ========================================
|
|
10
|
+
# Kafka Broker (KRaft Mode)
|
|
11
|
+
# ========================================
|
|
12
|
+
kafka:
|
|
13
|
+
image: apache/kafka:3.7.0
|
|
14
|
+
container_name: kafka
|
|
15
|
+
hostname: kafka
|
|
16
|
+
ports:
|
|
17
|
+
- "9092:9092" # Kafka client connections
|
|
18
|
+
- "9093:9093" # Controller
|
|
19
|
+
- "7071:7071" # JMX exporter
|
|
20
|
+
environment:
|
|
21
|
+
# KRaft configuration
|
|
22
|
+
KAFKA_NODE_ID: 1
|
|
23
|
+
KAFKA_PROCESS_ROLES: broker,controller
|
|
24
|
+
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
|
|
25
|
+
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
|
|
26
|
+
|
|
27
|
+
# Listeners
|
|
28
|
+
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093
|
|
29
|
+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092
|
|
30
|
+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,CONTROLLER:PLAINTEXT
|
|
31
|
+
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
|
|
32
|
+
|
|
33
|
+
# Log directories
|
|
34
|
+
KAFKA_LOG_DIRS: /var/lib/kafka/data
|
|
35
|
+
|
|
36
|
+
# Cluster ID (auto-generated on first start)
|
|
37
|
+
CLUSTER_ID: MkU3OEVBNTcwNTJENDM2Qk
|
|
38
|
+
|
|
39
|
+
# JVM settings
|
|
40
|
+
KAFKA_HEAP_OPTS: "-Xms1G -Xmx1G"
|
|
41
|
+
KAFKA_JVM_PERFORMANCE_OPTS: "-XX:+UseG1GC -XX:MaxGCPauseMillis=20"
|
|
42
|
+
|
|
43
|
+
# JMX for monitoring
|
|
44
|
+
KAFKA_JMX_OPTS: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.port=9999 -javaagent:/opt/jmx_prometheus_javaagent.jar=7071:/opt/kafka-broker.yml"
|
|
45
|
+
|
|
46
|
+
# Performance tuning
|
|
47
|
+
KAFKA_NUM_NETWORK_THREADS: 3
|
|
48
|
+
KAFKA_NUM_IO_THREADS: 8
|
|
49
|
+
KAFKA_SOCKET_SEND_BUFFER_BYTES: 102400
|
|
50
|
+
KAFKA_SOCKET_RECEIVE_BUFFER_BYTES: 102400
|
|
51
|
+
KAFKA_SOCKET_REQUEST_MAX_BYTES: 104857600
|
|
52
|
+
|
|
53
|
+
# Replication
|
|
54
|
+
KAFKA_DEFAULT_REPLICATION_FACTOR: 1
|
|
55
|
+
KAFKA_MIN_INSYNC_REPLICAS: 1
|
|
56
|
+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
|
|
57
|
+
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
|
|
58
|
+
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
|
|
59
|
+
|
|
60
|
+
# Log retention
|
|
61
|
+
KAFKA_LOG_RETENTION_HOURS: 24
|
|
62
|
+
KAFKA_LOG_SEGMENT_BYTES: 1073741824
|
|
63
|
+
KAFKA_LOG_RETENTION_CHECK_INTERVAL_MS: 300000
|
|
64
|
+
|
|
65
|
+
# Compression
|
|
66
|
+
KAFKA_COMPRESSION_TYPE: lz4
|
|
67
|
+
|
|
68
|
+
# Topic management
|
|
69
|
+
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
|
|
70
|
+
KAFKA_DELETE_TOPIC_ENABLE: "true"
|
|
71
|
+
volumes:
|
|
72
|
+
- kafka-data:/var/lib/kafka/data
|
|
73
|
+
- ./config/jmx_prometheus_javaagent.jar:/opt/jmx_prometheus_javaagent.jar:ro
|
|
74
|
+
- ./config/kafka-broker.yml:/opt/kafka-broker.yml:ro
|
|
75
|
+
healthcheck:
|
|
76
|
+
test: ["CMD-SHELL", "kafka-broker-api-versions --bootstrap-server localhost:9092 || exit 1"]
|
|
77
|
+
interval: 10s
|
|
78
|
+
timeout: 10s
|
|
79
|
+
retries: 5
|
|
80
|
+
start_period: 30s
|
|
81
|
+
networks:
|
|
82
|
+
- kafka-network
|
|
83
|
+
|
|
84
|
+
# ========================================
|
|
85
|
+
# Schema Registry
|
|
86
|
+
# ========================================
|
|
87
|
+
schema-registry:
|
|
88
|
+
image: confluentinc/cp-schema-registry:7.6.0
|
|
89
|
+
container_name: schema-registry
|
|
90
|
+
hostname: schema-registry
|
|
91
|
+
ports:
|
|
92
|
+
- "8081:8081"
|
|
93
|
+
environment:
|
|
94
|
+
SCHEMA_REGISTRY_HOST_NAME: schema-registry
|
|
95
|
+
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: kafka:9092
|
|
96
|
+
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
|
|
97
|
+
SCHEMA_REGISTRY_SCHEMA_REGISTRY_GROUP_ID: schema-registry
|
|
98
|
+
SCHEMA_REGISTRY_KAFKASTORE_TOPIC: _schemas
|
|
99
|
+
SCHEMA_REGISTRY_KAFKASTORE_TOPIC_REPLICATION_FACTOR: 1
|
|
100
|
+
depends_on:
|
|
101
|
+
kafka:
|
|
102
|
+
condition: service_healthy
|
|
103
|
+
healthcheck:
|
|
104
|
+
test: ["CMD", "curl", "-f", "http://localhost:8081/subjects"]
|
|
105
|
+
interval: 10s
|
|
106
|
+
timeout: 5s
|
|
107
|
+
retries: 5
|
|
108
|
+
networks:
|
|
109
|
+
- kafka-network
|
|
110
|
+
|
|
111
|
+
# ========================================
|
|
112
|
+
# Kafka UI
|
|
113
|
+
# ========================================
|
|
114
|
+
kafka-ui:
|
|
115
|
+
image: provectuslabs/kafka-ui:latest
|
|
116
|
+
container_name: kafka-ui
|
|
117
|
+
ports:
|
|
118
|
+
- "8080:8080"
|
|
119
|
+
environment:
|
|
120
|
+
KAFKA_CLUSTERS_0_NAME: local
|
|
121
|
+
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092
|
|
122
|
+
KAFKA_CLUSTERS_0_SCHEMAREGISTRY: http://schema-registry:8081
|
|
123
|
+
KAFKA_CLUSTERS_0_METRICS_PORT: 9999
|
|
124
|
+
DYNAMIC_CONFIG_ENABLED: "true"
|
|
125
|
+
depends_on:
|
|
126
|
+
- kafka
|
|
127
|
+
- schema-registry
|
|
128
|
+
networks:
|
|
129
|
+
- kafka-network
|
|
130
|
+
|
|
131
|
+
# ========================================
|
|
132
|
+
# Prometheus
|
|
133
|
+
# ========================================
|
|
134
|
+
prometheus:
|
|
135
|
+
image: prom/prometheus:latest
|
|
136
|
+
container_name: prometheus
|
|
137
|
+
ports:
|
|
138
|
+
- "9090:9090"
|
|
139
|
+
command:
|
|
140
|
+
- '--config.file=/etc/prometheus/prometheus.yml'
|
|
141
|
+
- '--storage.tsdb.path=/prometheus'
|
|
142
|
+
- '--web.console.libraries=/etc/prometheus/console_libraries'
|
|
143
|
+
- '--web.console.templates=/etc/prometheus/consoles'
|
|
144
|
+
volumes:
|
|
145
|
+
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
146
|
+
- prometheus-data:/prometheus
|
|
147
|
+
networks:
|
|
148
|
+
- kafka-network
|
|
149
|
+
|
|
150
|
+
# ========================================
|
|
151
|
+
# Grafana
|
|
152
|
+
# ========================================
|
|
153
|
+
grafana:
|
|
154
|
+
image: grafana/grafana:latest
|
|
155
|
+
container_name: grafana
|
|
156
|
+
ports:
|
|
157
|
+
- "3000:3000"
|
|
158
|
+
environment:
|
|
159
|
+
GF_SECURITY_ADMIN_USER: admin
|
|
160
|
+
GF_SECURITY_ADMIN_PASSWORD: admin
|
|
161
|
+
GF_INSTALL_PLUGINS: grafana-piechart-panel
|
|
162
|
+
volumes:
|
|
163
|
+
- ./config/grafana/provisioning:/etc/grafana/provisioning:ro
|
|
164
|
+
- ./config/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
165
|
+
- grafana-data:/var/lib/grafana
|
|
166
|
+
depends_on:
|
|
167
|
+
- prometheus
|
|
168
|
+
networks:
|
|
169
|
+
- kafka-network
|
|
170
|
+
|
|
171
|
+
# ========================================
|
|
172
|
+
# Networks
|
|
173
|
+
# ========================================
|
|
174
|
+
networks:
|
|
175
|
+
kafka-network:
|
|
176
|
+
driver: bridge
|
|
177
|
+
|
|
178
|
+
# ========================================
|
|
179
|
+
# Volumes
|
|
180
|
+
# ========================================
|
|
181
|
+
volumes:
|
|
182
|
+
kafka-data:
|
|
183
|
+
driver: local
|
|
184
|
+
prometheus-data:
|
|
185
|
+
driver: local
|
|
186
|
+
grafana-data:
|
|
187
|
+
driver: local
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Redpanda Local Development Environment
|
|
2
|
+
#
|
|
3
|
+
# Redpanda is a Kafka-compatible streaming platform (10x faster, C++)
|
|
4
|
+
# Includes: Redpanda cluster, Console UI, Prometheus
|
|
5
|
+
|
|
6
|
+
version: '3.8'
|
|
7
|
+
|
|
8
|
+
services:
|
|
9
|
+
# ========================================
|
|
10
|
+
# Redpanda Broker 1
|
|
11
|
+
# ========================================
|
|
12
|
+
redpanda-1:
|
|
13
|
+
image: docker.redpanda.com/redpandadata/redpanda:v24.2.4
|
|
14
|
+
container_name: redpanda-1
|
|
15
|
+
hostname: redpanda-1
|
|
16
|
+
ports:
|
|
17
|
+
- "9092:9092" # Kafka API
|
|
18
|
+
- "9644:9644" # Admin API
|
|
19
|
+
- "8082:8082" # HTTP Proxy
|
|
20
|
+
command:
|
|
21
|
+
- redpanda
|
|
22
|
+
- start
|
|
23
|
+
- --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19092
|
|
24
|
+
- --advertise-kafka-addr internal://redpanda-1:9092,external://localhost:9092
|
|
25
|
+
- --pandaproxy-addr internal://0.0.0.0:8082,external://0.0.0.0:18082
|
|
26
|
+
- --advertise-pandaproxy-addr internal://redpanda-1:8082,external://localhost:8082
|
|
27
|
+
- --schema-registry-addr internal://0.0.0.0:8081,external://0.0.0.0:18081
|
|
28
|
+
- --rpc-addr redpanda-1:33145
|
|
29
|
+
- --advertise-rpc-addr redpanda-1:33145
|
|
30
|
+
- --mode dev-container
|
|
31
|
+
- --smp 1
|
|
32
|
+
- --memory 1G
|
|
33
|
+
volumes:
|
|
34
|
+
- redpanda-1-data:/var/lib/redpanda/data
|
|
35
|
+
healthcheck:
|
|
36
|
+
test: ["CMD-SHELL", "rpk cluster health | grep 'Healthy:.*true' || exit 1"]
|
|
37
|
+
interval: 10s
|
|
38
|
+
timeout: 10s
|
|
39
|
+
retries: 5
|
|
40
|
+
start_period: 30s
|
|
41
|
+
networks:
|
|
42
|
+
- redpanda-network
|
|
43
|
+
|
|
44
|
+
# ========================================
|
|
45
|
+
# Redpanda Broker 2
|
|
46
|
+
# ========================================
|
|
47
|
+
redpanda-2:
|
|
48
|
+
image: docker.redpanda.com/redpandadata/redpanda:v24.2.4
|
|
49
|
+
container_name: redpanda-2
|
|
50
|
+
hostname: redpanda-2
|
|
51
|
+
ports:
|
|
52
|
+
- "9093:9092"
|
|
53
|
+
- "9645:9644"
|
|
54
|
+
- "8083:8082"
|
|
55
|
+
command:
|
|
56
|
+
- redpanda
|
|
57
|
+
- start
|
|
58
|
+
- --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19093
|
|
59
|
+
- --advertise-kafka-addr internal://redpanda-2:9092,external://localhost:9093
|
|
60
|
+
- --pandaproxy-addr internal://0.0.0.0:8082,external://0.0.0.0:18083
|
|
61
|
+
- --advertise-pandaproxy-addr internal://redpanda-2:8082,external://localhost:8083
|
|
62
|
+
- --schema-registry-addr internal://0.0.0.0:8081,external://0.0.0.0:18082
|
|
63
|
+
- --rpc-addr redpanda-2:33145
|
|
64
|
+
- --advertise-rpc-addr redpanda-2:33145
|
|
65
|
+
- --seeds redpanda-1:33145
|
|
66
|
+
- --mode dev-container
|
|
67
|
+
- --smp 1
|
|
68
|
+
- --memory 1G
|
|
69
|
+
volumes:
|
|
70
|
+
- redpanda-2-data:/var/lib/redpanda/data
|
|
71
|
+
healthcheck:
|
|
72
|
+
test: ["CMD-SHELL", "rpk cluster health | grep 'Healthy:.*true' || exit 1"]
|
|
73
|
+
interval: 10s
|
|
74
|
+
timeout: 10s
|
|
75
|
+
retries: 5
|
|
76
|
+
start_period: 30s
|
|
77
|
+
depends_on:
|
|
78
|
+
- redpanda-1
|
|
79
|
+
networks:
|
|
80
|
+
- redpanda-network
|
|
81
|
+
|
|
82
|
+
# ========================================
|
|
83
|
+
# Redpanda Broker 3
|
|
84
|
+
# ========================================
|
|
85
|
+
redpanda-3:
|
|
86
|
+
image: docker.redpanda.com/redpandadata/redpanda:v24.2.4
|
|
87
|
+
container_name: redpanda-3
|
|
88
|
+
hostname: redpanda-3
|
|
89
|
+
ports:
|
|
90
|
+
- "9094:9092"
|
|
91
|
+
- "9646:9644"
|
|
92
|
+
- "8084:8082"
|
|
93
|
+
command:
|
|
94
|
+
- redpanda
|
|
95
|
+
- start
|
|
96
|
+
- --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19094
|
|
97
|
+
- --advertise-kafka-addr internal://redpanda-3:9092,external://localhost:9094
|
|
98
|
+
- --pandaproxy-addr internal://0.0.0.0:8082,external://0.0.0.0:18084
|
|
99
|
+
- --advertise-pandaproxy-addr internal://redpanda-3:8082,external://localhost:8084
|
|
100
|
+
- --schema-registry-addr internal://0.0.0.0:8081,external://0.0.0.0:18083
|
|
101
|
+
- --rpc-addr redpanda-3:33145
|
|
102
|
+
- --advertise-rpc-addr redpanda-3:33145
|
|
103
|
+
- --seeds redpanda-1:33145
|
|
104
|
+
- --mode dev-container
|
|
105
|
+
- --smp 1
|
|
106
|
+
- --memory 1G
|
|
107
|
+
volumes:
|
|
108
|
+
- redpanda-3-data:/var/lib/redpanda/data
|
|
109
|
+
healthcheck:
|
|
110
|
+
test: ["CMD-SHELL", "rpk cluster health | grep 'Healthy:.*true' || exit 1"]
|
|
111
|
+
interval: 10s
|
|
112
|
+
timeout: 10s
|
|
113
|
+
retries: 5
|
|
114
|
+
start_period: 30s
|
|
115
|
+
depends_on:
|
|
116
|
+
- redpanda-1
|
|
117
|
+
networks:
|
|
118
|
+
- redpanda-network
|
|
119
|
+
|
|
120
|
+
# ========================================
|
|
121
|
+
# Redpanda Console (UI)
|
|
122
|
+
# ========================================
|
|
123
|
+
console:
|
|
124
|
+
image: docker.redpanda.com/redpandadata/console:v2.6.0
|
|
125
|
+
container_name: redpanda-console
|
|
126
|
+
ports:
|
|
127
|
+
- "8080:8080"
|
|
128
|
+
environment:
|
|
129
|
+
CONFIG_FILEPATH: /tmp/config.yml
|
|
130
|
+
KAFKA_BROKERS: redpanda-1:9092,redpanda-2:9092,redpanda-3:9092
|
|
131
|
+
KAFKA_SCHEMAREGISTRY_ENABLED: "true"
|
|
132
|
+
KAFKA_SCHEMAREGISTRY_URLS: http://redpanda-1:8081
|
|
133
|
+
volumes:
|
|
134
|
+
- ./config/console-config.yml:/tmp/config.yml:ro
|
|
135
|
+
depends_on:
|
|
136
|
+
- redpanda-1
|
|
137
|
+
- redpanda-2
|
|
138
|
+
- redpanda-3
|
|
139
|
+
networks:
|
|
140
|
+
- redpanda-network
|
|
141
|
+
|
|
142
|
+
# ========================================
|
|
143
|
+
# Prometheus (metrics)
|
|
144
|
+
# ========================================
|
|
145
|
+
prometheus:
|
|
146
|
+
image: prom/prometheus:latest
|
|
147
|
+
container_name: prometheus
|
|
148
|
+
ports:
|
|
149
|
+
- "9090:9090"
|
|
150
|
+
command:
|
|
151
|
+
- '--config.file=/etc/prometheus/prometheus.yml'
|
|
152
|
+
- '--storage.tsdb.path=/prometheus'
|
|
153
|
+
volumes:
|
|
154
|
+
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml:ro
|
|
155
|
+
- prometheus-data:/prometheus
|
|
156
|
+
networks:
|
|
157
|
+
- redpanda-network
|
|
158
|
+
|
|
159
|
+
# ========================================
|
|
160
|
+
# Grafana (dashboards)
|
|
161
|
+
# ========================================
|
|
162
|
+
grafana:
|
|
163
|
+
image: grafana/grafana:latest
|
|
164
|
+
container_name: grafana
|
|
165
|
+
ports:
|
|
166
|
+
- "3000:3000"
|
|
167
|
+
environment:
|
|
168
|
+
GF_SECURITY_ADMIN_USER: admin
|
|
169
|
+
GF_SECURITY_ADMIN_PASSWORD: admin
|
|
170
|
+
volumes:
|
|
171
|
+
- ./config/grafana/provisioning:/etc/grafana/provisioning:ro
|
|
172
|
+
- ./config/grafana/dashboards:/var/lib/grafana/dashboards:ro
|
|
173
|
+
- grafana-data:/var/lib/grafana
|
|
174
|
+
depends_on:
|
|
175
|
+
- prometheus
|
|
176
|
+
networks:
|
|
177
|
+
- redpanda-network
|
|
178
|
+
|
|
179
|
+
# ========================================
|
|
180
|
+
# Networks
|
|
181
|
+
# ========================================
|
|
182
|
+
networks:
|
|
183
|
+
redpanda-network:
|
|
184
|
+
driver: bridge
|
|
185
|
+
|
|
186
|
+
# ========================================
|
|
187
|
+
# Volumes
|
|
188
|
+
# ========================================
|
|
189
|
+
volumes:
|
|
190
|
+
redpanda-1-data:
|
|
191
|
+
driver: local
|
|
192
|
+
redpanda-2-data:
|
|
193
|
+
driver: local
|
|
194
|
+
redpanda-3-data:
|
|
195
|
+
driver: local
|
|
196
|
+
prometheus-data:
|
|
197
|
+
driver: local
|
|
198
|
+
grafana-data:
|
|
199
|
+
driver: local
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Kafka Consumer Example (Node.js)
|
|
3
|
+
*
|
|
4
|
+
* Install: npm install kafkajs
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const { Kafka, logLevel } = require('kafkajs');
|
|
8
|
+
|
|
9
|
+
// ========================================
|
|
10
|
+
// Configuration
|
|
11
|
+
// ========================================
|
|
12
|
+
|
|
13
|
+
const kafka = new Kafka({
|
|
14
|
+
clientId: 'my-app',
|
|
15
|
+
brokers: ['localhost:9092'],
|
|
16
|
+
logLevel: logLevel.INFO
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const consumer = kafka.consumer({
|
|
20
|
+
groupId: 'my-consumer-group',
|
|
21
|
+
|
|
22
|
+
// Session timeout (broker detects consumer failure)
|
|
23
|
+
sessionTimeout: 30000,
|
|
24
|
+
heartbeatInterval: 3000,
|
|
25
|
+
|
|
26
|
+
// Rebalancing strategy
|
|
27
|
+
partitionAssigners: [
|
|
28
|
+
kafka.PartitionAssigners.roundRobin // or cooperativeSticky
|
|
29
|
+
],
|
|
30
|
+
|
|
31
|
+
// Auto-commit (disable for manual offset management)
|
|
32
|
+
autoCommit: true,
|
|
33
|
+
autoCommitInterval: 5000
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
// ========================================
|
|
37
|
+
// Consumer Functions
|
|
38
|
+
// ========================================
|
|
39
|
+
|
|
40
|
+
async function consumeMessages(topic) {
|
|
41
|
+
await consumer.subscribe({
|
|
42
|
+
topic,
|
|
43
|
+
fromBeginning: false // true = read from earliest offset
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
await consumer.run({
|
|
47
|
+
// Messages per partition to fetch
|
|
48
|
+
eachBatchAutoResolve: true,
|
|
49
|
+
partitionsConsumedConcurrently: 3,
|
|
50
|
+
|
|
51
|
+
// Process each message
|
|
52
|
+
eachMessage: async ({ topic, partition, message }) => {
|
|
53
|
+
try {
|
|
54
|
+
const value = JSON.parse(message.value.toString());
|
|
55
|
+
const headers = {};
|
|
56
|
+
for (const [key, val] of Object.entries(message.headers)) {
|
|
57
|
+
headers[key] = val.toString();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
console.log({
|
|
61
|
+
topic,
|
|
62
|
+
partition,
|
|
63
|
+
offset: message.offset,
|
|
64
|
+
key: message.key?.toString(),
|
|
65
|
+
value,
|
|
66
|
+
headers,
|
|
67
|
+
timestamp: message.timestamp
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Process the message
|
|
71
|
+
await processMessage(value);
|
|
72
|
+
|
|
73
|
+
// Optional: Manual offset commit
|
|
74
|
+
// await consumer.commitOffsets([{
|
|
75
|
+
// topic,
|
|
76
|
+
// partition,
|
|
77
|
+
// offset: (parseInt(message.offset) + 1).toString()
|
|
78
|
+
// }]);
|
|
79
|
+
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.error('ā Error processing message:', error);
|
|
82
|
+
// Send to dead letter queue
|
|
83
|
+
// await sendToDLQ(message, error);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async function consumeBatch(topic) {
|
|
90
|
+
await consumer.subscribe({ topic });
|
|
91
|
+
|
|
92
|
+
await consumer.run({
|
|
93
|
+
// Process messages in batches
|
|
94
|
+
eachBatch: async ({
|
|
95
|
+
batch,
|
|
96
|
+
resolveOffset,
|
|
97
|
+
heartbeat,
|
|
98
|
+
commitOffsetsIfNecessary,
|
|
99
|
+
isRunning,
|
|
100
|
+
isStale
|
|
101
|
+
}) => {
|
|
102
|
+
console.log(`š¦ Processing batch: ${batch.messages.length} messages`);
|
|
103
|
+
|
|
104
|
+
for (let message of batch.messages) {
|
|
105
|
+
if (!isRunning() || isStale()) {
|
|
106
|
+
break; // Stop if consumer is shutting down
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
const value = JSON.parse(message.value.toString());
|
|
111
|
+
await processMessage(value);
|
|
112
|
+
|
|
113
|
+
// Mark message as processed
|
|
114
|
+
resolveOffset(message.offset);
|
|
115
|
+
|
|
116
|
+
// Send heartbeat to avoid rebalance
|
|
117
|
+
await heartbeat();
|
|
118
|
+
} catch (error) {
|
|
119
|
+
console.error('ā Error in batch:', error);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Commit all offsets
|
|
124
|
+
await commitOffsetsIfNecessary();
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// ========================================
|
|
130
|
+
// Message Processing
|
|
131
|
+
// ========================================
|
|
132
|
+
|
|
133
|
+
async function processMessage(message) {
|
|
134
|
+
// Your business logic here
|
|
135
|
+
console.log('āļø Processing:', message);
|
|
136
|
+
|
|
137
|
+
// Simulate processing time
|
|
138
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
139
|
+
|
|
140
|
+
// Example: Handle different event types
|
|
141
|
+
switch (message.event) {
|
|
142
|
+
case 'user_login':
|
|
143
|
+
await handleUserLogin(message);
|
|
144
|
+
break;
|
|
145
|
+
case 'order_created':
|
|
146
|
+
await handleOrderCreated(message);
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
console.log('Unknown event type:', message.event);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async function handleUserLogin(message) {
|
|
154
|
+
console.log('š¤ User login:', message.userId);
|
|
155
|
+
// Update user last login time
|
|
156
|
+
// Send welcome email
|
|
157
|
+
// etc.
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function handleOrderCreated(message) {
|
|
161
|
+
console.log('š Order created:', message);
|
|
162
|
+
// Process order
|
|
163
|
+
// Send confirmation email
|
|
164
|
+
// Update inventory
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// ========================================
|
|
168
|
+
// Dead Letter Queue
|
|
169
|
+
// ========================================
|
|
170
|
+
|
|
171
|
+
async function sendToDLQ(message, error) {
|
|
172
|
+
const producer = kafka.producer();
|
|
173
|
+
await producer.connect();
|
|
174
|
+
|
|
175
|
+
await producer.send({
|
|
176
|
+
topic: 'my-topic-dlq',
|
|
177
|
+
messages: [{
|
|
178
|
+
key: message.key,
|
|
179
|
+
value: message.value,
|
|
180
|
+
headers: {
|
|
181
|
+
...message.headers,
|
|
182
|
+
'error-message': error.message,
|
|
183
|
+
'error-stack': error.stack,
|
|
184
|
+
'failed-at': Date.now().toString(),
|
|
185
|
+
'original-topic': message.topic,
|
|
186
|
+
'original-partition': message.partition.toString(),
|
|
187
|
+
'original-offset': message.offset.toString()
|
|
188
|
+
}
|
|
189
|
+
}]
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
await producer.disconnect();
|
|
193
|
+
console.log('š® Message sent to DLQ');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ========================================
|
|
197
|
+
// Main Function
|
|
198
|
+
// ========================================
|
|
199
|
+
|
|
200
|
+
async function main() {
|
|
201
|
+
await consumer.connect();
|
|
202
|
+
console.log('š” Consumer connected');
|
|
203
|
+
|
|
204
|
+
// Start consuming
|
|
205
|
+
await consumeMessages('my-topic');
|
|
206
|
+
|
|
207
|
+
// Or use batch processing
|
|
208
|
+
// await consumeBatch('my-topic');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ========================================
|
|
212
|
+
// Run
|
|
213
|
+
// ========================================
|
|
214
|
+
|
|
215
|
+
main().catch(console.error);
|
|
216
|
+
|
|
217
|
+
// Graceful shutdown
|
|
218
|
+
const shutdown = async () => {
|
|
219
|
+
console.log('\nš Shutting down consumer...');
|
|
220
|
+
await consumer.disconnect();
|
|
221
|
+
process.exit(0);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
process.on('SIGINT', shutdown);
|
|
225
|
+
process.on('SIGTERM', shutdown);
|