@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.
- package/.mcp-config.example.json +26 -0
- package/CHANGELOG.md +40 -0
- package/README.md +311 -685
- package/dist/cli/v2.cli.d.ts +13 -0
- package/dist/cli/v2.cli.js +290 -0
- package/dist/index.d.ts +12 -13
- package/dist/index.js +18 -19
- package/dist/v2/config/ConfigLoader.d.ts +50 -0
- package/dist/v2/config/ConfigLoader.js +205 -0
- package/dist/v2/config/DefaultConfig.d.ts +9 -0
- package/dist/v2/config/DefaultConfig.js +191 -0
- package/dist/v2/core/MCPServerManager.d.ts +22 -0
- package/dist/v2/core/MCPServerManager.js +92 -0
- package/dist/v2/core/SessionManager.d.ts +72 -0
- package/dist/v2/core/SessionManager.js +200 -0
- package/dist/v2/core/YamaV2Orchestrator.d.ts +112 -0
- package/dist/v2/core/YamaV2Orchestrator.js +549 -0
- package/dist/v2/prompts/EnhancementSystemPrompt.d.ts +8 -0
- package/dist/v2/prompts/EnhancementSystemPrompt.js +216 -0
- package/dist/v2/prompts/PromptBuilder.d.ts +38 -0
- package/dist/v2/prompts/PromptBuilder.js +228 -0
- package/dist/v2/prompts/ReviewSystemPrompt.d.ts +8 -0
- package/dist/v2/prompts/ReviewSystemPrompt.js +270 -0
- package/dist/v2/types/config.types.d.ts +120 -0
- package/dist/v2/types/config.types.js +5 -0
- package/dist/v2/types/mcp.types.d.ts +191 -0
- package/dist/v2/types/mcp.types.js +6 -0
- package/dist/v2/types/v2.types.d.ts +182 -0
- package/dist/v2/types/v2.types.js +42 -0
- package/dist/v2/utils/ObservabilityConfig.d.ts +22 -0
- package/dist/v2/utils/ObservabilityConfig.js +48 -0
- package/package.json +11 -9
- package/yama.config.example.yaml +214 -193
- package/dist/cli/index.d.ts +0 -12
- package/dist/cli/index.js +0 -538
- package/dist/core/ContextGatherer.d.ts +0 -110
- package/dist/core/ContextGatherer.js +0 -470
- package/dist/core/Guardian.d.ts +0 -81
- package/dist/core/Guardian.js +0 -474
- package/dist/core/providers/BitbucketProvider.d.ts +0 -105
- package/dist/core/providers/BitbucketProvider.js +0 -489
- package/dist/features/CodeReviewer.d.ts +0 -173
- package/dist/features/CodeReviewer.js +0 -1707
- package/dist/features/DescriptionEnhancer.d.ts +0 -64
- package/dist/features/DescriptionEnhancer.js +0 -445
- package/dist/features/MultiInstanceProcessor.d.ts +0 -74
- package/dist/features/MultiInstanceProcessor.js +0 -360
- package/dist/types/index.d.ts +0 -624
- package/dist/types/index.js +0 -104
- package/dist/utils/Cache.d.ts +0 -103
- package/dist/utils/Cache.js +0 -444
- package/dist/utils/ConfigManager.d.ts +0 -88
- package/dist/utils/ConfigManager.js +0 -603
- package/dist/utils/ContentSimilarityService.d.ts +0 -74
- package/dist/utils/ContentSimilarityService.js +0 -215
- package/dist/utils/ExactDuplicateRemover.d.ts +0 -77
- package/dist/utils/ExactDuplicateRemover.js +0 -361
- package/dist/utils/Logger.d.ts +0 -31
- package/dist/utils/Logger.js +0 -214
- package/dist/utils/MemoryBankManager.d.ts +0 -73
- package/dist/utils/MemoryBankManager.js +0 -310
- package/dist/utils/ParallelProcessing.d.ts +0 -140
- package/dist/utils/ParallelProcessing.js +0 -333
- package/dist/utils/ProviderLimits.d.ts +0 -58
- package/dist/utils/ProviderLimits.js +0 -143
- package/dist/utils/RetryManager.d.ts +0 -78
- package/dist/utils/RetryManager.js +0 -205
package/yama.config.example.yaml
CHANGED
|
@@ -1,204 +1,225 @@
|
|
|
1
1
|
# Yama Configuration Example
|
|
2
|
-
#
|
|
2
|
+
# Copy this file to yama.config.yaml and customize for your project
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
version: 2
|
|
5
|
+
configType: "yama-v2"
|
|
6
|
+
|
|
7
|
+
# ============================================================================
|
|
8
|
+
# Display & Streaming Configuration
|
|
9
|
+
# ============================================================================
|
|
5
10
|
display:
|
|
6
|
-
showBanner: true # Show
|
|
7
|
-
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
#
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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
|
-
#
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
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
|
-
|
|
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"
|
|
201
|
-
fallbackPaths:
|
|
174
|
+
path: "memory-bank"
|
|
175
|
+
fallbackPaths:
|
|
202
176
|
- "docs/memory-bank"
|
|
203
177
|
- ".memory-bank"
|
|
204
|
-
|
|
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
|
package/dist/cli/index.d.ts
DELETED
|
@@ -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
|