@juspay/yama 1.5.1 โ†’ 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.mcp-config.example.json +26 -0
  2. package/CHANGELOG.md +40 -0
  3. package/README.md +311 -685
  4. package/dist/cli/v2.cli.d.ts +13 -0
  5. package/dist/cli/v2.cli.js +290 -0
  6. package/dist/index.d.ts +12 -13
  7. package/dist/index.js +18 -19
  8. package/dist/v2/config/ConfigLoader.d.ts +50 -0
  9. package/dist/v2/config/ConfigLoader.js +205 -0
  10. package/dist/v2/config/DefaultConfig.d.ts +9 -0
  11. package/dist/v2/config/DefaultConfig.js +191 -0
  12. package/dist/v2/core/MCPServerManager.d.ts +22 -0
  13. package/dist/v2/core/MCPServerManager.js +92 -0
  14. package/dist/v2/core/SessionManager.d.ts +72 -0
  15. package/dist/v2/core/SessionManager.js +200 -0
  16. package/dist/v2/core/YamaV2Orchestrator.d.ts +112 -0
  17. package/dist/v2/core/YamaV2Orchestrator.js +549 -0
  18. package/dist/v2/prompts/EnhancementSystemPrompt.d.ts +8 -0
  19. package/dist/v2/prompts/EnhancementSystemPrompt.js +216 -0
  20. package/dist/v2/prompts/PromptBuilder.d.ts +38 -0
  21. package/dist/v2/prompts/PromptBuilder.js +228 -0
  22. package/dist/v2/prompts/ReviewSystemPrompt.d.ts +8 -0
  23. package/dist/v2/prompts/ReviewSystemPrompt.js +270 -0
  24. package/dist/v2/types/config.types.d.ts +120 -0
  25. package/dist/v2/types/config.types.js +5 -0
  26. package/dist/v2/types/mcp.types.d.ts +191 -0
  27. package/dist/v2/types/mcp.types.js +6 -0
  28. package/dist/v2/types/v2.types.d.ts +182 -0
  29. package/dist/v2/types/v2.types.js +42 -0
  30. package/dist/v2/utils/ObservabilityConfig.d.ts +22 -0
  31. package/dist/v2/utils/ObservabilityConfig.js +48 -0
  32. package/package.json +11 -9
  33. package/yama.config.example.yaml +214 -193
  34. package/dist/cli/index.d.ts +0 -12
  35. package/dist/cli/index.js +0 -538
  36. package/dist/core/ContextGatherer.d.ts +0 -110
  37. package/dist/core/ContextGatherer.js +0 -470
  38. package/dist/core/Guardian.d.ts +0 -81
  39. package/dist/core/Guardian.js +0 -474
  40. package/dist/core/providers/BitbucketProvider.d.ts +0 -105
  41. package/dist/core/providers/BitbucketProvider.js +0 -489
  42. package/dist/features/CodeReviewer.d.ts +0 -173
  43. package/dist/features/CodeReviewer.js +0 -1707
  44. package/dist/features/DescriptionEnhancer.d.ts +0 -64
  45. package/dist/features/DescriptionEnhancer.js +0 -445
  46. package/dist/features/MultiInstanceProcessor.d.ts +0 -74
  47. package/dist/features/MultiInstanceProcessor.js +0 -360
  48. package/dist/types/index.d.ts +0 -624
  49. package/dist/types/index.js +0 -104
  50. package/dist/utils/Cache.d.ts +0 -103
  51. package/dist/utils/Cache.js +0 -444
  52. package/dist/utils/ConfigManager.d.ts +0 -88
  53. package/dist/utils/ConfigManager.js +0 -603
  54. package/dist/utils/ContentSimilarityService.d.ts +0 -74
  55. package/dist/utils/ContentSimilarityService.js +0 -215
  56. package/dist/utils/ExactDuplicateRemover.d.ts +0 -77
  57. package/dist/utils/ExactDuplicateRemover.js +0 -361
  58. package/dist/utils/Logger.d.ts +0 -31
  59. package/dist/utils/Logger.js +0 -214
  60. package/dist/utils/MemoryBankManager.d.ts +0 -73
  61. package/dist/utils/MemoryBankManager.js +0 -310
  62. package/dist/utils/ParallelProcessing.d.ts +0 -140
  63. package/dist/utils/ParallelProcessing.js +0 -333
  64. package/dist/utils/ProviderLimits.d.ts +0 -58
  65. package/dist/utils/ProviderLimits.js +0 -143
  66. package/dist/utils/RetryManager.d.ts +0 -78
  67. package/dist/utils/RetryManager.js +0 -205
@@ -1,204 +1,225 @@
1
1
  # Yama Configuration Example
2
- # This file contains all available configuration options with explanations
2
+ # Copy this file to yama.config.yaml and customize for your project
3
3
 
4
- # Display Configuration
4
+ version: 2
5
+ configType: "yama-v2"
6
+
7
+ # ============================================================================
8
+ # Display & Streaming Configuration
9
+ # ============================================================================
5
10
  display:
6
- showBanner: true # Show ASCII art banner on startup (default: true)
7
-
8
- # AI Provider Configuration
9
- providers:
10
- ai:
11
- provider: "auto" # Options: auto, google-ai, openai, anthropic, azure, bedrock
12
- model: "best" # Model name or "best" for auto-selection
13
- temperature: 0.3 # Lower = more focused (0.0-1.0)
14
- maxTokens: 60000 # Maximum tokens for response (provider-aware limits will be applied automatically)
15
- timeout: "15m" # Timeout for AI operations
16
- enableAnalytics: true
17
- enableEvaluation: false
18
-
19
- # Git Platform Configuration
20
- git:
21
- platform: "bitbucket" # Options: bitbucket, github, gitlab, azure-devops
22
- credentials:
23
- username: "${BITBUCKET_USERNAME}" # Environment variable
24
- token: "${BITBUCKET_TOKEN}" # Environment variable
25
- baseUrl: "${BITBUCKET_BASE_URL}" # Your Bitbucket server URL
26
-
27
- # Feature Configuration
28
- features:
29
- # Code Review Configuration
30
- codeReview:
31
- enabled: true
32
- postSummaryComment: true # Post summary comment at the end of review (default: true)
33
- severityLevels: ["CRITICAL", "MAJOR", "MINOR", "SUGGESTION"]
34
- categories:
35
- [
36
- "security",
37
- "performance",
38
- "maintainability",
39
- "functionality",
40
- "error_handling",
41
- ]
42
- excludePatterns:
43
- - "*.lock"
44
- - "*.svg"
45
- - "*.png"
46
- - "*.jpg"
47
- - "*.gif"
48
- - "*.min.js"
49
- - "*.min.css"
50
- - "dist/**"
51
- - "build/**"
52
- - "vendor/**"
53
- contextLines: 3 # Lines of context around changes
54
- focusAreas:
55
- - "Security vulnerabilities"
56
- - "Performance bottlenecks"
57
- - "Error handling"
58
- - "Code quality"
59
-
60
- # NEW: Batch Processing Configuration
61
- batchProcessing:
62
- enabled: true # Enable batch processing for large PRs
63
- maxFilesPerBatch: 3 # Maximum files to process in each batch
64
- prioritizeSecurityFiles: true # Process security-sensitive files first
65
- parallelBatches: false # Keep for backward compatibility
66
- batchDelayMs: 1000 # Delay between batches in milliseconds
67
- singleRequestThreshold: 5 # Use single request for PRs with โ‰ค5 files
68
-
69
- # NEW: Parallel Processing Configuration
70
- parallel:
71
- enabled: true # Enable parallel processing by default
72
- maxConcurrentBatches: 3 # Maximum concurrent batches
73
- rateLimitStrategy: "fixed" # Options: fixed, adaptive
74
- tokenBudgetDistribution: "equal" # Options: equal, weighted
75
- failureHandling: "continue" # Options: continue, stop-all
76
-
77
- # Multi-Instance Processing Configuration
78
- multiInstance:
79
- enabled: true # Enable multi-instance review
80
- instanceCount: 2 # Number of instances to run in parallel
81
- instances:
82
- - name: "primary"
83
- provider: "vertex"
84
- model: "gemini-2.5-pro"
85
- temperature: 0.3
86
- weight: 1.0
87
- - name: "secondary"
88
- provider: "vertex"
89
- model: "gemini-2.5-pro"
90
- temperature: 0.1
91
- weight: 1.0
92
- deduplication:
93
- enabled: true
94
- similarityThreshold: 40 # Similarity percentage threshold (0-100)
95
- maxCommentsToPost: 30
96
- prioritizeBy: "severity"
97
-
98
- # NEW: Semantic Comment Deduplication Configuration
99
- semanticDeduplication:
100
- enabled: true # Enable AI-powered semantic similarity analysis
101
- similarityThreshold: 70 # Similarity percentage threshold (0-100)
102
- batchSize: 15 # Number of violations to process per batch
103
- timeout: "5m" # Timeout for similarity analysis
104
- fallbackOnError: true # Return all violations if AI analysis fails
105
- logMatches: true # Log detailed similarity match information
106
-
107
- # Description Enhancement Configuration
108
- descriptionEnhancement:
109
- enabled: true
110
- preserveContent: true # Always preserve existing content
111
- autoFormat: true
112
- requiredSections:
113
- - key: "changelog"
114
- name: "Changelog (Modules Modified)"
115
- required: true
116
- - key: "testcases"
117
- name: "Test Cases (What to be tested)"
118
- required: true
119
- - key: "config_changes"
120
- name: "CAC Config Or Service Config Changes"
121
- required: true
122
-
123
- # NEW: Diff Strategy Configuration
124
- diffStrategy:
11
+ showBanner: true # Show Yama banner on startup
12
+ streamingMode: false # Enable real-time streaming of AI decisions
13
+ verboseToolCalls: false # Log every MCP tool call
14
+ showAIThinking: false # Display AI reasoning process
15
+
16
+ # ============================================================================
17
+ # AI Configuration
18
+ # ============================================================================
19
+ ai:
20
+ provider: "auto" # auto | google-ai | anthropic | openai | bedrock
21
+ model: "gemini-2.5-pro" # or claude-3-7-sonnet-20250219-v1:0, gpt-4, etc.
22
+ temperature: 0.2 # Lower = more deterministic (0.0-1.0)
23
+ maxTokens: 128000 # Maximum tokens per AI call
24
+ enableAnalytics: true # Track token usage and costs
25
+ enableEvaluation: false # Enable quality evaluation (slower)
26
+ timeout: "15m" # Maximum time for review
27
+ retryAttempts: 3 # Number of retries on failure
28
+
29
+ # Conversation memory for maintaining review state
30
+ conversationMemory:
125
31
  enabled: true
126
- thresholds:
127
- wholeDiffMaxFiles: 2 # Use whole diff for โ‰ค2 files
128
- fileByFileMinFiles: 3 # Use file-by-file for โ‰ฅ3 files
129
- # Optional: Force a specific strategy regardless of file count
130
- # forceStrategy: "file-by-file" # Options: whole, file-by-file, auto
131
-
132
- # Security Scan Configuration (Future)
133
- securityScan:
134
- enabled: false
135
- level: "strict" # Options: strict, moderate, basic
136
- scanTypes: ["dependencies", "secrets", "vulnerabilities"]
137
-
138
- # Analytics Configuration (Future)
139
- analytics:
140
- enabled: false
141
- trackMetrics: true
142
- exportFormat: "json" # Options: json, csv, yaml
143
-
144
- # Cache Configuration
145
- cache:
32
+ store: "memory" # memory | redis
33
+ maxSessions: 50
34
+ maxTurnsPerSession: 300 # Long reviews need many turns
35
+ enableSummarization: false # Don't summarize mid-review
36
+
37
+ # ============================================================================
38
+ # MCP Servers Configuration
39
+ # ============================================================================
40
+ # Bitbucket MCP is always enabled (hardcoded)
41
+ # Jira MCP can be enabled/disabled here
42
+ mcpServers:
43
+ jira:
44
+ enabled: true # Set to false to disable Jira integration
45
+
46
+ # ============================================================================
47
+ # Review Configuration
48
+ # ============================================================================
49
+ review:
146
50
  enabled: true
147
- ttl: "30m" # Time to live for cache entries
148
- maxSize: "100MB"
149
- storage: "memory" # Options: memory, redis, file
150
51
 
151
- # Performance Configuration
152
- performance:
153
- batch:
154
- enabled: true
155
- maxConcurrent: 5 # Max concurrent API calls
156
- delayBetween: "1s" # Delay between batches
157
- optimization:
158
- reuseConnections: true
159
- compressRequests: false
160
- enableHttp2: true
161
-
162
- # Custom Rules Configuration
163
- rules:
164
- security:
165
- - name: "No hardcoded secrets"
166
- pattern: "(password|secret|key)\\s*=\\s*[\"'][^\"']+[\"']"
167
- severity: "CRITICAL"
168
- message: "Hardcoded secrets detected"
169
- suggestion: "Use environment variables or secure configuration"
170
-
171
- - name: "SQL injection prevention"
172
- pattern: "query\\([^?]+\\+.*\\)"
173
- severity: "CRITICAL"
174
- message: "Potential SQL injection vulnerability"
175
- suggestion: "Use parameterized queries"
176
-
177
- performance:
178
- - name: "Avoid N+1 queries"
179
- pattern: "forEach.*await.*query"
180
- severity: "MAJOR"
181
- message: "Potential N+1 query pattern detected"
182
- suggestion: "Consider batch loading or joins"
183
-
184
- # Reporting Configuration
185
- reporting:
186
- formats: ["markdown", "json"]
187
- includeAnalytics: true
188
- includeMetrics: true
189
-
190
- # Monitoring Configuration (Future)
191
- monitoring:
192
- enabled: false
193
- metrics: ["api_calls", "cache_hits", "processing_time"]
194
- exportFormat: "prometheus"
195
- interval: "1m"
52
+ # High-level workflow instructions (combined with base system prompt)
53
+ workflowInstructions: |
54
+ Follow the autonomous review workflow:
55
+ 1. Read PR details and find Jira ticket
56
+ 2. Read project standards from memory-bank
57
+ 3. Analyze files one-by-one
58
+ 4. Search code for context as needed
59
+ 5. Comment on issues immediately
60
+ 6. Make final decision based on blocking criteria
61
+
62
+ # Analysis focus areas (in priority order)
63
+ focusAreas:
64
+ - name: "Security Analysis"
65
+ priority: "CRITICAL"
66
+ description: |
67
+ - SQL/NoSQL injection vulnerabilities
68
+ - Cross-Site Scripting (XSS)
69
+ - Authentication/Authorization flaws
70
+ - Hardcoded secrets, API keys, passwords
71
+ - Input validation and sanitization
72
+ - Data exposure and privacy violations
73
+
74
+ - name: "Performance Review"
75
+ priority: "MAJOR"
76
+ description: |
77
+ - N+1 database query patterns
78
+ - Memory leaks and resource management
79
+ - Algorithm complexity issues
80
+ - Missing caching opportunities
81
+ - Blocking I/O in async contexts
82
+
83
+ - name: "Code Quality"
84
+ priority: "MAJOR"
85
+ description: |
86
+ - SOLID principle violations
87
+ - Poor error handling
88
+ - Code duplication (DRY violations)
89
+ - Poor naming conventions
90
+ - Missing edge case handling
91
+
92
+ # Blocking criteria (AI uses these to decide whether to block PR)
93
+ blockingCriteria:
94
+ - condition: "ANY CRITICAL severity issue"
95
+ action: "BLOCK"
96
+ reason: "Security or data loss risk"
97
+
98
+ - condition: "3 or more MAJOR severity issues"
99
+ action: "BLOCK"
100
+ reason: "Too many significant bugs/performance issues"
101
+
102
+ - condition: "Jira requirement coverage < 70%"
103
+ action: "BLOCK"
104
+ reason: "Incomplete implementation of requirements"
105
+
106
+ # Files to exclude from analysis
107
+ excludePatterns:
108
+ - "*.lock"
109
+ - "*.svg"
110
+ - "*.min.js"
111
+ - "*.map"
112
+ - "package-lock.json"
113
+ - "pnpm-lock.yaml"
114
+ - "yarn.lock"
115
+
116
+ # Context settings
117
+ contextLines: 3 # Lines of context around each diff change
118
+ maxFilesPerReview: 100 # Maximum files to review
119
+ fileAnalysisTimeout: "2m" # Timeout per file
120
+
121
+ # Tool usage preferences
122
+ toolPreferences:
123
+ lazyLoading: true # Read files on-demand (RECOMMENDED)
124
+ cacheToolResults: true # Cache MCP tool responses
125
+ parallelToolCalls: false # Sequential for better context
126
+ maxToolCallsPerFile: 20 # Prevent infinite loops
127
+ enableCodeSearch: true # Allow search_code() usage
128
+ enableDirectoryListing: true # Allow list_directory_content()
129
+
130
+ # ============================================================================
131
+ # PR Description Enhancement
132
+ # ============================================================================
133
+ descriptionEnhancement:
134
+ enabled: true
196
135
 
197
- # Memory Bank Configuration
136
+ instructions: |
137
+ Enhance the PR description using Jira requirements and diff analysis.
138
+ Generate comprehensive, well-structured description with all required sections.
139
+
140
+ requiredSections:
141
+ - key: "summary"
142
+ name: "๐Ÿ“‹ Summary"
143
+ required: true
144
+ description: "Clear overview of what this PR accomplishes"
145
+
146
+ - key: "changes"
147
+ name: "๐Ÿ”ง Changes Made"
148
+ required: true
149
+ description: "Specific technical changes with file references"
150
+
151
+ - key: "jira"
152
+ name: "๐ŸŽซ Jira Reference"
153
+ required: false
154
+ description: "Link to Jira ticket and requirement coverage"
155
+
156
+ - key: "testing"
157
+ name: "๐Ÿงช Testing Strategy"
158
+ required: true
159
+ description: "How changes were tested and validation approach"
160
+
161
+ - key: "impact"
162
+ name: "โšก Impact & Considerations"
163
+ required: false
164
+ description: "Business impact, performance implications, breaking changes"
165
+
166
+ preserveContent: true # Don't remove existing images/links/tables
167
+ autoFormat: true # Clean up markdown formatting
168
+
169
+ # ============================================================================
170
+ # Memory Bank & Project Context
171
+ # ============================================================================
198
172
  memoryBank:
199
173
  enabled: true
200
- path: "memory-bank" # Primary path to look for memory bank files
201
- fallbackPaths: # Optional fallback paths if primary doesn't exist
174
+ path: "memory-bank"
175
+ fallbackPaths:
202
176
  - "docs/memory-bank"
203
177
  - ".memory-bank"
204
- - "project-docs/context"
178
+
179
+ # Standard files to read for project context
180
+ standardFiles:
181
+ - "project-overview.md"
182
+ - "architecture.md"
183
+ - "coding-standards.md"
184
+ - "security-guidelines.md"
185
+
186
+ # ============================================================================
187
+ # Project-Specific Standards (Override in your repository)
188
+ # ============================================================================
189
+ projectStandards:
190
+ # Path to project-specific prompt files (relative to repo root)
191
+ customPromptsPath: "config/prompts/"
192
+
193
+ # Additional focus areas beyond defaults
194
+ additionalFocusAreas: []
195
+
196
+ # Custom blocking rules
197
+ customBlockingRules: []
198
+
199
+ # Severity level overrides
200
+ severityOverrides: {}
201
+
202
+ # ============================================================================
203
+ # Monitoring & Analytics
204
+ # ============================================================================
205
+ monitoring:
206
+ enabled: true
207
+ logToolCalls: true # Log every MCP tool execution
208
+ logAIDecisions: true # Log AI decision points
209
+ logTokenUsage: true # Log token usage for cost tracking
210
+ exportFormat: "json" # json | csv
211
+ exportPath: ".yama/analytics/"
212
+
213
+ # ============================================================================
214
+ # Performance & Cost Controls
215
+ # ============================================================================
216
+ performance:
217
+ maxReviewDuration: "15m" # Kill switch for long reviews
218
+
219
+ tokenBudget:
220
+ maxTokensPerReview: 500000 # Hard limit on tokens
221
+ warningThreshold: 400000 # Warn when approaching limit
222
+
223
+ costControls:
224
+ maxCostPerReview: 2.0 # USD limit per review
225
+ warningThreshold: 1.5 # Warn at $1.50
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Yama CLI - Enhanced command line interface
4
- * Provides backward compatibility with pr-police.js and pr-describe.js
5
- * Plus new unified commands for the enhanced functionality
6
- */
7
- /**
8
- * Main execution
9
- */
10
- declare function main(): void;
11
- export { main };
12
- //# sourceMappingURL=index.d.ts.map