@juspay/yama 1.6.0 → 2.1.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 +46 -0
- package/README.md +311 -685
- package/dist/cli/v2.cli.d.ts +13 -0
- package/dist/cli/v2.cli.js +359 -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 +187 -0
- package/dist/v2/core/LearningOrchestrator.d.ts +65 -0
- package/dist/v2/core/LearningOrchestrator.js +499 -0
- package/dist/v2/core/MCPServerManager.d.ts +22 -0
- package/dist/v2/core/MCPServerManager.js +100 -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/learning/FeedbackExtractor.d.ts +46 -0
- package/dist/v2/learning/FeedbackExtractor.js +237 -0
- package/dist/v2/learning/KnowledgeBaseManager.d.ts +91 -0
- package/dist/v2/learning/KnowledgeBaseManager.js +475 -0
- package/dist/v2/learning/types.d.ts +121 -0
- package/dist/v2/learning/types.js +15 -0
- package/dist/v2/prompts/EnhancementSystemPrompt.d.ts +8 -0
- package/dist/v2/prompts/EnhancementSystemPrompt.js +216 -0
- package/dist/v2/prompts/LangfusePromptManager.d.ts +48 -0
- package/dist/v2/prompts/LangfusePromptManager.js +144 -0
- package/dist/v2/prompts/LearningSystemPrompt.d.ts +11 -0
- package/dist/v2/prompts/LearningSystemPrompt.js +180 -0
- package/dist/v2/prompts/PromptBuilder.d.ts +45 -0
- package/dist/v2/prompts/PromptBuilder.js +257 -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 +141 -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 +16 -10
- package/yama.config.example.yaml +259 -204
- 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 -480
- 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 -70
- package/dist/features/DescriptionEnhancer.js +0 -511
- 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 -602
- 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/README.md
CHANGED
|
@@ -1,811 +1,463 @@
|
|
|
1
|
-
# ⚔️ Yama
|
|
1
|
+
# ⚔️ Yama - AI-Native Code Review Guardian
|
|
2
2
|
|
|
3
|
-
> **Enterprise-grade
|
|
3
|
+
> **Enterprise-grade autonomous code review powered by AI and MCP tools**
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@juspay/yama)
|
|
6
6
|
[](https://github.com/juspay/yama/blob/main/LICENSE)
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
|
|
9
|
-
## 🎯 **What is Yama?**
|
|
10
|
-
|
|
11
|
-
Yama is the **code quality judge** that combines and optimizes the functionality from pr-police.js and pr-describe.js into a unified, enterprise-grade toolkit. It provides **AI-powered code review** and **intelligent description enhancement** with **90% fewer API calls** through unified context gathering.
|
|
12
|
-
|
|
13
9
|
**Named after the Hindu deity of justice and death, Yama judges code quality and ensures only the worthy changes pass through.**
|
|
14
10
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
## ✨ **Core Features**
|
|
18
|
-
|
|
19
|
-
### 🔍 **AI-Powered Code Review**
|
|
11
|
+
## What's New in V2?
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
- **⚡ Performance Review**: N+1 queries, memory leaks, algorithm efficiency
|
|
23
|
-
- **🏗️ Code Quality**: SOLID principles, maintainability, best practices
|
|
24
|
-
- **💬 Smart Comments**: Contextual inline comments with actionable suggestions
|
|
25
|
-
- **📊 Severity Levels**: CRITICAL, MAJOR, MINOR, SUGGESTION with intelligent categorization
|
|
13
|
+
Yama V2 represents a **complete architectural shift** from coded orchestration to **AI-native autonomous orchestration**:
|
|
26
14
|
|
|
27
|
-
|
|
15
|
+
| Aspect | V1 | V2 |
|
|
16
|
+
| ------------------------- | ---------------------- | ----------------------------- |
|
|
17
|
+
| **Architecture** | Coded orchestration | AI autonomous orchestration |
|
|
18
|
+
| **Bitbucket Integration** | Direct handler imports | External MCP server |
|
|
19
|
+
| **Context Strategy** | Pre-fetch everything | Lazy load on-demand |
|
|
20
|
+
| **AI Role** | Static analyzer | Autonomous agent with tools |
|
|
21
|
+
| **Decision Making** | TypeScript code | AI decides |
|
|
22
|
+
| **Tool Access** | None | All operations via MCP |
|
|
23
|
+
| **File Analysis** | All at once in prompt | File-by-file AI loop |
|
|
24
|
+
| **Jira Integration** | None | MCP tools for requirements |
|
|
25
|
+
| **Comment Posting** | Batch after analysis | Real-time as found |
|
|
26
|
+
| **PR Blocking** | Manual logic | AI decision based on criteria |
|
|
28
27
|
|
|
29
|
-
|
|
30
|
-
- **📋 Required Sections**: Configurable sections (Changelog, Test Cases, Config Changes, etc.)
|
|
31
|
-
- **🤖 AI Enhancement**: Automatically improves incomplete descriptions while preserving content
|
|
32
|
-
- **🧠 Project Context**: Uses memory-bank and .clinerules for contextual enhancement
|
|
28
|
+
## Architecture Overview
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
```
|
|
31
|
+
YamaV2Orchestrator
|
|
32
|
+
↓
|
|
33
|
+
NeuroLink AI Agent (Autonomous)
|
|
34
|
+
↓
|
|
35
|
+
MCP Tools (Bitbucket + Jira)
|
|
36
|
+
↓
|
|
37
|
+
Pull Request Operations
|
|
38
|
+
```
|
|
40
39
|
|
|
41
|
-
###
|
|
40
|
+
### AI Autonomous Workflow
|
|
42
41
|
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
42
|
+
1. **Context Gathering** (AI-driven)
|
|
43
|
+
- Reads PR details
|
|
44
|
+
- Finds and reads Jira ticket
|
|
45
|
+
- Loads project standards from memory-bank
|
|
46
|
+
- Reads .clinerules for review guidelines
|
|
47
47
|
|
|
48
|
-
|
|
48
|
+
2. **File-by-File Analysis** (AI-driven)
|
|
49
|
+
- Reads each file diff individually
|
|
50
|
+
- Searches code for context when needed
|
|
51
|
+
- Reads reference files to understand patterns
|
|
52
|
+
- Comments on issues immediately
|
|
49
53
|
|
|
50
|
-
|
|
54
|
+
3. **PR Description Enhancement** (AI-driven)
|
|
55
|
+
- Analyzes changes and requirements
|
|
56
|
+
- Generates comprehensive description
|
|
57
|
+
- Updates PR with enhanced content
|
|
51
58
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
| **Memory Usage** | High duplication | Shared context | **50% reduction** |
|
|
57
|
-
| **Cache Efficiency** | None | 80-90% hit ratio | **New capability** |
|
|
58
|
-
| **Large PRs (40+ files)** | Often fails/timeouts | Intelligent batching | **Reliable processing** |
|
|
59
|
+
4. **Final Decision** (AI-driven)
|
|
60
|
+
- Evaluates all findings
|
|
61
|
+
- Applies blocking criteria
|
|
62
|
+
- Approves or blocks PR
|
|
59
63
|
|
|
60
|
-
|
|
64
|
+
## Installation & Setup
|
|
61
65
|
|
|
62
|
-
|
|
66
|
+
### 1. Prerequisites
|
|
63
67
|
|
|
64
68
|
```bash
|
|
65
|
-
#
|
|
66
|
-
|
|
69
|
+
# Node.js 18+ required
|
|
70
|
+
node --version
|
|
67
71
|
|
|
68
|
-
#
|
|
69
|
-
npm install @juspay/yama
|
|
72
|
+
# Install Yama V2
|
|
73
|
+
npm install @juspay/yama@2.0.0
|
|
70
74
|
```
|
|
71
75
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
## ⚡ **Quick Start**
|
|
76
|
+
### 2. Environment Variables
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
Create a `.env` file:
|
|
77
79
|
|
|
78
80
|
```bash
|
|
79
|
-
#
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
yama init
|
|
84
|
-
```
|
|
81
|
+
# Bitbucket
|
|
82
|
+
BITBUCKET_USERNAME=your.email@company.com
|
|
83
|
+
BITBUCKET_APP_PASSWORD=your-http-access-token
|
|
84
|
+
BITBUCKET_BASE_URL=https://bitbucket.yourcompany.com
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
# Jira (optional)
|
|
87
|
+
JIRA_EMAIL=your-email@company.com
|
|
88
|
+
JIRA_API_TOKEN=your-jira-api-token
|
|
89
|
+
JIRA_BASE_URL=https://yourcompany.atlassian.net
|
|
87
90
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
# Process PR with both review and description enhancement
|
|
92
|
-
yama process --workspace YOUR_WORKSPACE --repository my-repo --branch feature/auth
|
|
91
|
+
# AI Provider (optional - defaults to auto)
|
|
92
|
+
AI_PROVIDER=google-ai
|
|
93
|
+
AI_MODEL=gemini-2.5-pro
|
|
93
94
|
|
|
94
|
-
#
|
|
95
|
-
|
|
95
|
+
# Langfuse Observability (optional)
|
|
96
|
+
LANGFUSE_PUBLIC_KEY=your-public-key
|
|
97
|
+
LANGFUSE_SECRET_KEY=your-secret-key
|
|
98
|
+
LANGFUSE_BASE_URL=https://cloud.langfuse.com
|
|
96
99
|
```
|
|
97
100
|
|
|
98
|
-
|
|
101
|
+
### 3. Initialize Configuration
|
|
99
102
|
|
|
100
103
|
```bash
|
|
101
|
-
#
|
|
102
|
-
yama
|
|
104
|
+
# Create default config
|
|
105
|
+
npx yama init
|
|
103
106
|
|
|
104
|
-
#
|
|
105
|
-
yama
|
|
107
|
+
# Or copy example
|
|
108
|
+
cp yama.config.example.yaml yama.config.yaml
|
|
109
|
+
|
|
110
|
+
# Edit configuration
|
|
111
|
+
vim yama.config.yaml
|
|
106
112
|
```
|
|
107
113
|
|
|
108
|
-
|
|
114
|
+
### 4. Verify Setup
|
|
109
115
|
|
|
110
116
|
```bash
|
|
111
|
-
#
|
|
112
|
-
yama
|
|
113
|
-
|
|
114
|
-
# Still works exactly like pr-describe.js / pr-scribe.js
|
|
115
|
-
yama scribe --workspace YOUR_WORKSPACE --repository my-repo --branch feature/auth
|
|
117
|
+
# Test initialization
|
|
118
|
+
npx yama review --help
|
|
116
119
|
```
|
|
117
120
|
|
|
118
|
-
|
|
121
|
+
## Usage
|
|
119
122
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
### **File Exclusion Patterns**
|
|
123
|
+
### Basic Review
|
|
123
124
|
|
|
124
125
|
```bash
|
|
125
|
-
#
|
|
126
|
-
yama
|
|
126
|
+
# Review by PR ID
|
|
127
|
+
npx yama review \
|
|
127
128
|
--workspace YOUR_WORKSPACE \
|
|
128
129
|
--repository my-repo \
|
|
129
|
-
--
|
|
130
|
-
--exclude "*.lock,*.svg,*.min.js,dist/**,node_modules/**,coverage/**"
|
|
130
|
+
--pr 123
|
|
131
131
|
|
|
132
|
-
#
|
|
133
|
-
yama review
|
|
134
|
-
|
|
132
|
+
# Review by branch
|
|
133
|
+
npx yama review \
|
|
134
|
+
--workspace YOUR_WORKSPACE \
|
|
135
|
+
--repository my-repo \
|
|
136
|
+
--branch feature/new-feature
|
|
135
137
|
```
|
|
136
138
|
|
|
137
|
-
###
|
|
139
|
+
### Dry Run Mode
|
|
138
140
|
|
|
139
141
|
```bash
|
|
140
|
-
#
|
|
141
|
-
yama review
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
# Force cache refresh
|
|
147
|
-
yama process --force-refresh
|
|
142
|
+
# Test without posting comments
|
|
143
|
+
npx yama review \
|
|
144
|
+
--workspace YOUR_WORKSPACE \
|
|
145
|
+
--repository my-repo \
|
|
146
|
+
--pr 123 \
|
|
147
|
+
--dry-run
|
|
148
148
|
```
|
|
149
149
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
## ⚙️ **Configuration File**
|
|
153
|
-
|
|
154
|
-
Create `yama.config.yaml` in your project root:
|
|
155
|
-
|
|
156
|
-
```yaml
|
|
157
|
-
# AI Provider Configuration
|
|
158
|
-
ai:
|
|
159
|
-
provider: "auto" # auto, google-ai, openai, anthropic
|
|
160
|
-
enableFallback: true
|
|
161
|
-
enableAnalytics: true
|
|
162
|
-
timeout: "5m"
|
|
163
|
-
temperature: 0.7
|
|
164
|
-
|
|
165
|
-
# Git Platform Configuration
|
|
166
|
-
git:
|
|
167
|
-
platform: "bitbucket"
|
|
168
|
-
credentials:
|
|
169
|
-
username: "${BITBUCKET_USERNAME}"
|
|
170
|
-
token: "${BITBUCKET_TOKEN}"
|
|
171
|
-
baseUrl: "https://your-bitbucket-server.com"
|
|
172
|
-
defaultWorkspace: "${DEFAULT_WORKSPACE}"
|
|
173
|
-
|
|
174
|
-
# Feature Configuration
|
|
175
|
-
features:
|
|
176
|
-
codeReview:
|
|
177
|
-
enabled: true
|
|
178
|
-
severityLevels: ["CRITICAL", "MAJOR", "MINOR", "SUGGESTION"]
|
|
179
|
-
excludePatterns:
|
|
180
|
-
- "*.lock"
|
|
181
|
-
- "*.svg"
|
|
182
|
-
- "*.min.js"
|
|
183
|
-
- "node_modules/**"
|
|
184
|
-
- "dist/**"
|
|
185
|
-
- "build/**"
|
|
186
|
-
- "coverage/**"
|
|
187
|
-
contextLines: 3
|
|
188
|
-
|
|
189
|
-
# Custom AI Prompts for Code Review (Advanced)
|
|
190
|
-
systemPrompt: |
|
|
191
|
-
You are an Expert Security Code Reviewer focusing on enterprise standards.
|
|
192
|
-
Prioritize security vulnerabilities, performance issues, and code quality.
|
|
193
|
-
Provide actionable feedback with specific examples and solutions.
|
|
194
|
-
|
|
195
|
-
focusAreas:
|
|
196
|
-
- "🔒 Security Analysis (CRITICAL PRIORITY)"
|
|
197
|
-
- "⚡ Performance Review"
|
|
198
|
-
- "🏗️ Code Quality & Best Practices"
|
|
199
|
-
- "🧪 Testing & Error Handling"
|
|
200
|
-
- "📖 Documentation & Maintainability"
|
|
201
|
-
|
|
202
|
-
# Multi-Instance Processing Configuration
|
|
203
|
-
multiInstance:
|
|
204
|
-
enabled: true
|
|
205
|
-
instanceCount: 2
|
|
206
|
-
instances:
|
|
207
|
-
- name: "primary"
|
|
208
|
-
provider: "vertex"
|
|
209
|
-
model: "gemini-2.5-pro"
|
|
210
|
-
temperature: 0.3
|
|
211
|
-
- name: "secondary"
|
|
212
|
-
provider: "vertex"
|
|
213
|
-
model: "gemini-2.5-pro"
|
|
214
|
-
temperature: 0.1
|
|
215
|
-
deduplication:
|
|
216
|
-
enabled: true
|
|
217
|
-
similarityThreshold: 40 # 0-100 percentage scale
|
|
218
|
-
maxCommentsToPost: 30
|
|
219
|
-
prioritizeBy: "severity"
|
|
220
|
-
|
|
221
|
-
# Semantic Deduplication Configuration
|
|
222
|
-
semanticDeduplication:
|
|
223
|
-
enabled: true
|
|
224
|
-
similarityThreshold: 70 # 0-100 percentage scale
|
|
225
|
-
batchSize: 15
|
|
226
|
-
timeout: "5m"
|
|
227
|
-
fallbackOnError: true
|
|
228
|
-
logMatches: true
|
|
229
|
-
|
|
230
|
-
descriptionEnhancement:
|
|
231
|
-
enabled: true
|
|
232
|
-
preserveContent: true # NEVER remove existing content
|
|
233
|
-
requiredSections:
|
|
234
|
-
# Default sections
|
|
235
|
-
- key: "changelog"
|
|
236
|
-
name: "📋 Changelog (Modules Modified)"
|
|
237
|
-
required: true
|
|
150
|
+
### Enhance Description Only
|
|
238
151
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
required: true
|
|
246
|
-
|
|
247
|
-
# Optional custom sections
|
|
248
|
-
- key: "breaking_changes"
|
|
249
|
-
name: "⚠️ Breaking Changes"
|
|
250
|
-
required: false
|
|
152
|
+
```bash
|
|
153
|
+
npx yama enhance \
|
|
154
|
+
--workspace YOUR_WORKSPACE \
|
|
155
|
+
--repository my-repo \
|
|
156
|
+
--pr 123
|
|
157
|
+
```
|
|
251
158
|
|
|
252
|
-
|
|
253
|
-
name: "🔄 Migration Notes"
|
|
254
|
-
required: false
|
|
159
|
+
### Programmatic Usage
|
|
255
160
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
required: false
|
|
161
|
+
```typescript
|
|
162
|
+
import { createYamaV2 } from "@juspay/yama";
|
|
259
163
|
|
|
260
|
-
|
|
261
|
-
name: "🔒 Security Considerations"
|
|
262
|
-
required: false
|
|
164
|
+
const yama = createYamaV2();
|
|
263
165
|
|
|
264
|
-
|
|
265
|
-
systemPrompt: |
|
|
266
|
-
You are an Expert Technical Writer specializing in pull request documentation.
|
|
267
|
-
Focus on clarity, completeness, and helping reviewers understand the changes.
|
|
268
|
-
CRITICAL: Return ONLY the enhanced description without meta-commentary.
|
|
166
|
+
await yama.initialize();
|
|
269
167
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
168
|
+
const result = await yama.startReview({
|
|
169
|
+
workspace: "YOUR_WORKSPACE",
|
|
170
|
+
repository: "my-repo",
|
|
171
|
+
pullRequestId: 123,
|
|
172
|
+
dryRun: false,
|
|
173
|
+
});
|
|
273
174
|
|
|
274
|
-
|
|
275
|
-
|
|
175
|
+
console.log("Decision:", result.decision);
|
|
176
|
+
console.log("Issues:", result.statistics.issuesFound);
|
|
177
|
+
```
|
|
276
178
|
|
|
277
|
-
|
|
278
|
-
[Clear overview of what this PR accomplishes]
|
|
179
|
+
## Configuration
|
|
279
180
|
|
|
280
|
-
|
|
281
|
-
[Specific technical changes with file references]
|
|
181
|
+
### Basic Configuration
|
|
282
182
|
|
|
283
|
-
|
|
284
|
-
|
|
183
|
+
```yaml
|
|
184
|
+
version: 2
|
|
185
|
+
configType: "yama-v2"
|
|
285
186
|
|
|
286
|
-
|
|
287
|
-
|
|
187
|
+
ai:
|
|
188
|
+
provider: "auto"
|
|
189
|
+
model: "gemini-2.5-pro"
|
|
190
|
+
temperature: 0.2
|
|
288
191
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
ttl: "1h"
|
|
293
|
-
maxSize: "100mb"
|
|
294
|
-
storage: "memory"
|
|
192
|
+
mcpServers:
|
|
193
|
+
jira:
|
|
194
|
+
enabled: true
|
|
295
195
|
|
|
296
|
-
|
|
297
|
-
monitoring:
|
|
196
|
+
review:
|
|
298
197
|
enabled: true
|
|
299
|
-
|
|
198
|
+
focusAreas:
|
|
199
|
+
- name: "Security Analysis"
|
|
200
|
+
priority: "CRITICAL"
|
|
201
|
+
- name: "Performance Review"
|
|
202
|
+
priority: "MAJOR"
|
|
300
203
|
```
|
|
301
204
|
|
|
302
|
-
|
|
205
|
+
### Advanced Configuration
|
|
303
206
|
|
|
304
|
-
|
|
207
|
+
See [yama.config.example.yaml](yama.config.example.yaml) for complete configuration options.
|
|
305
208
|
|
|
306
|
-
|
|
209
|
+
## Project-Specific Standards
|
|
307
210
|
|
|
308
|
-
|
|
309
|
-
import { Guardian, createGuardian } from "@juspay/yama";
|
|
310
|
-
|
|
311
|
-
// Create Guardian instance
|
|
312
|
-
const guardian = createGuardian({
|
|
313
|
-
providers: {
|
|
314
|
-
ai: {
|
|
315
|
-
provider: "google-ai",
|
|
316
|
-
enableAnalytics: true,
|
|
317
|
-
},
|
|
318
|
-
git: {
|
|
319
|
-
platform: "bitbucket",
|
|
320
|
-
credentials: {
|
|
321
|
-
username: process.env.BITBUCKET_USERNAME!,
|
|
322
|
-
token: process.env.BITBUCKET_TOKEN!,
|
|
323
|
-
baseUrl: "https://your-bitbucket-server.com",
|
|
324
|
-
},
|
|
325
|
-
},
|
|
326
|
-
},
|
|
327
|
-
});
|
|
211
|
+
Create custom review standards for your repository:
|
|
328
212
|
|
|
329
|
-
|
|
330
|
-
|
|
213
|
+
```bash
|
|
214
|
+
mkdir -p memory-bank
|
|
331
215
|
```
|
|
332
216
|
|
|
333
|
-
|
|
217
|
+
Create `memory-bank/coding-standards.md`:
|
|
334
218
|
|
|
335
|
-
```
|
|
336
|
-
|
|
337
|
-
const result = await guardian.processPR({
|
|
338
|
-
workspace: "YOUR_WORKSPACE",
|
|
339
|
-
repository: "my-repo",
|
|
340
|
-
branch: "feature/auth",
|
|
341
|
-
operations: ["review", "enhance-description"],
|
|
342
|
-
});
|
|
219
|
+
```markdown
|
|
220
|
+
# Project-Specific Review Standards
|
|
343
221
|
|
|
344
|
-
|
|
345
|
-
console.log(`API calls saved: ${result.performance.apiCallsSaved}`);
|
|
346
|
-
console.log(`Cache hit ratio: ${result.performance.cacheHitRatio}%`);
|
|
347
|
-
```
|
|
222
|
+
## Critical Security Rules
|
|
348
223
|
|
|
349
|
-
|
|
224
|
+
1. ALL payment data MUST be encrypted
|
|
225
|
+
2. NO credit card numbers in logs
|
|
226
|
+
3. ALL database queries MUST use parameterized statements
|
|
350
227
|
|
|
351
|
-
|
|
352
|
-
// Real-time progress updates
|
|
353
|
-
for await (const update of guardian.processPRStream({
|
|
354
|
-
workspace: "YOUR_WORKSPACE",
|
|
355
|
-
repository: "my-repo",
|
|
356
|
-
branch: "feature/auth",
|
|
357
|
-
operations: ["review", "enhance-description"],
|
|
358
|
-
})) {
|
|
359
|
-
console.log(`${update.operation}: ${update.status} - ${update.message}`);
|
|
360
|
-
|
|
361
|
-
if (update.progress) {
|
|
362
|
-
console.log(`Progress: ${update.progress}%`);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### **Individual Operations**
|
|
368
|
-
|
|
369
|
-
```typescript
|
|
370
|
-
// Code review only
|
|
371
|
-
const reviewResult = await guardian.reviewCode({
|
|
372
|
-
workspace: "YOUR_WORKSPACE",
|
|
373
|
-
repository: "my-repo",
|
|
374
|
-
branch: "feature/auth",
|
|
375
|
-
excludePatterns: ["*.lock", "*.svg"],
|
|
376
|
-
});
|
|
228
|
+
## Performance Requirements
|
|
377
229
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
workspace: "YOUR_WORKSPACE",
|
|
381
|
-
repository: "my-repo",
|
|
382
|
-
branch: "feature/auth",
|
|
383
|
-
customSections: [
|
|
384
|
-
{ key: "summary", name: "📝 Summary", required: true },
|
|
385
|
-
{ key: "rollback", name: "🔄 Rollback Plan", required: true },
|
|
386
|
-
],
|
|
387
|
-
});
|
|
230
|
+
- API response time: < 200ms p95
|
|
231
|
+
- Database queries: < 50ms p95
|
|
388
232
|
```
|
|
389
233
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
```typescript
|
|
393
|
-
import { configManager } from "@juspay/yama";
|
|
394
|
-
|
|
395
|
-
// Enable hot-reload for configuration changes
|
|
396
|
-
const stopWatching = configManager.enableHotReload((newConfig) => {
|
|
397
|
-
console.log("Configuration updated:", newConfig);
|
|
398
|
-
// Optionally reinitialize Guardian with new config
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
// Stop watching when done
|
|
402
|
-
process.on("SIGINT", () => {
|
|
403
|
-
stopWatching();
|
|
404
|
-
process.exit(0);
|
|
405
|
-
});
|
|
406
|
-
```
|
|
234
|
+
Yama V2 AI will automatically read and apply these standards.
|
|
407
235
|
|
|
408
|
-
|
|
236
|
+
## AI Autonomous Features
|
|
409
237
|
|
|
410
|
-
|
|
238
|
+
### Lazy Context Loading
|
|
411
239
|
|
|
412
|
-
|
|
240
|
+
AI reads only what it needs:
|
|
413
241
|
|
|
414
|
-
|
|
242
|
+
- Sees unfamiliar function? → `search_code("functionName")`
|
|
243
|
+
- Needs to understand import? → `get_file_content("path/to/file.ts")`
|
|
244
|
+
- Confused about structure? → `list_directory_content("src/")`
|
|
415
245
|
|
|
416
|
-
|
|
417
|
-
// File count ≤ 5: Whole diff strategy
|
|
418
|
-
if (fileCount <= 5) {
|
|
419
|
-
strategy = "whole"; // Fast, provides full context
|
|
420
|
-
reason = "Small PR, whole diff provides better context";
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// File count 6-20: Still whole diff (manageable)
|
|
424
|
-
else if (fileCount <= 20) {
|
|
425
|
-
strategy = "whole";
|
|
426
|
-
reason = "Moderate PR size, whole diff manageable";
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
// File count 21-50: File-by-file with batching
|
|
430
|
-
else if (fileCount <= 50) {
|
|
431
|
-
strategy = "file-by-file"; // Batch process 5 files at a time
|
|
432
|
-
reason = "Large PR, file-by-file more efficient";
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
// File count > 50: Essential batching for performance
|
|
436
|
-
else {
|
|
437
|
-
strategy = "file-by-file";
|
|
438
|
-
reason = "Very large PR, batching required for performance";
|
|
439
|
-
}
|
|
440
|
-
```
|
|
246
|
+
### Real-Time Feedback
|
|
441
247
|
|
|
442
|
-
|
|
248
|
+
AI comments as it finds issues:
|
|
443
249
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
for (let i = 0; i < filteredFiles.length; i += batchSize) {
|
|
448
|
-
const batch = filteredFiles.slice(i, i + batchSize);
|
|
449
|
-
|
|
450
|
-
// Process batch in parallel with intelligent caching
|
|
451
|
-
const batchResults = await Promise.all(
|
|
452
|
-
batch.map((file) => processFileWithCache(file)),
|
|
453
|
-
);
|
|
454
|
-
}
|
|
455
|
-
```
|
|
250
|
+
- No batching - immediate feedback
|
|
251
|
+
- Severity-based emojis (🔒 CRITICAL, ⚠️ MAJOR, 💡 MINOR, 💬 SUGGESTION)
|
|
252
|
+
- Actionable suggestions with code examples
|
|
456
253
|
|
|
457
|
-
|
|
254
|
+
### Requirement Alignment
|
|
458
255
|
|
|
459
|
-
|
|
256
|
+
AI reads Jira tickets:
|
|
460
257
|
|
|
461
|
-
|
|
258
|
+
- Extracts acceptance criteria
|
|
259
|
+
- Verifies implementation matches requirements
|
|
260
|
+
- Calculates requirement coverage
|
|
261
|
+
- Blocks PR if coverage < 70%
|
|
462
262
|
|
|
463
|
-
|
|
464
|
-
# Default exclusions (always applied unless overridden)
|
|
465
|
-
excludePatterns:
|
|
466
|
-
- "*.lock" # Package lock files
|
|
467
|
-
- "*.svg" # SVG images
|
|
468
|
-
- "*.min.js" # Minified JavaScript
|
|
469
|
-
- "*.min.css" # Minified CSS
|
|
470
|
-
- "node_modules/**" # Dependencies
|
|
471
|
-
- "dist/**" # Build outputs
|
|
472
|
-
- "build/**" # Build outputs
|
|
473
|
-
- "coverage/**" # Test coverage
|
|
474
|
-
```
|
|
263
|
+
### Code Context Understanding
|
|
475
264
|
|
|
476
|
-
|
|
265
|
+
AI uses tools to understand code:
|
|
477
266
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
--exclude "**/*.test.js" # Test files in any directory
|
|
482
|
-
--exclude "src/generated/**" # Entire generated directory
|
|
483
|
-
--exclude "*.{lock,svg,min.js}" # Multiple extensions
|
|
484
|
-
--exclude "!important.lock" # Exclude everything except important.lock
|
|
485
|
-
```
|
|
267
|
+
- `search_code()` - Find function definitions
|
|
268
|
+
- `get_file_content()` - Read related files
|
|
269
|
+
- `list_directory_content()` - Explore structure
|
|
486
270
|
|
|
487
|
-
|
|
271
|
+
## Blocking Criteria
|
|
488
272
|
|
|
489
|
-
|
|
490
|
-
// Different exclusions for different operations
|
|
491
|
-
const reviewExclusions = ["*.lock", "*.svg", "**/*.test.js"];
|
|
492
|
-
const enhancementExclusions = ["*.lock"]; // Allow SVGs in descriptions
|
|
493
|
-
|
|
494
|
-
await guardian.processPR({
|
|
495
|
-
operations: [
|
|
496
|
-
{
|
|
497
|
-
type: "review",
|
|
498
|
-
excludePatterns: reviewExclusions,
|
|
499
|
-
},
|
|
500
|
-
{
|
|
501
|
-
type: "enhance-description",
|
|
502
|
-
excludePatterns: enhancementExclusions,
|
|
503
|
-
},
|
|
504
|
-
],
|
|
505
|
-
});
|
|
506
|
-
```
|
|
273
|
+
AI applies these criteria automatically:
|
|
507
274
|
|
|
508
|
-
|
|
275
|
+
1. **ANY CRITICAL issue** → BLOCKS PR
|
|
276
|
+
- Security vulnerabilities
|
|
277
|
+
- Data loss risks
|
|
278
|
+
- Authentication bypasses
|
|
509
279
|
|
|
510
|
-
|
|
280
|
+
2. **3+ MAJOR issues** → BLOCKS PR
|
|
281
|
+
- Significant bugs
|
|
282
|
+
- Performance problems
|
|
283
|
+
- Logic errors
|
|
511
284
|
|
|
512
|
-
|
|
285
|
+
3. **Requirement coverage < 70%** → BLOCKS PR (when Jira enabled)
|
|
286
|
+
- Incomplete Jira implementation
|
|
287
|
+
- Missing acceptance criteria
|
|
513
288
|
|
|
514
|
-
|
|
515
|
-
const defaultSections = [
|
|
516
|
-
{ key: "changelog", name: "📋 Changelog (Modules Modified)", required: true },
|
|
517
|
-
{
|
|
518
|
-
key: "testcases",
|
|
519
|
-
name: "🧪 Test Cases (What to be tested)",
|
|
520
|
-
required: true,
|
|
521
|
-
},
|
|
522
|
-
{ key: "config_changes", name: "⚙️ Config Changes", required: true },
|
|
523
|
-
];
|
|
524
|
-
```
|
|
289
|
+
## MCP Servers
|
|
525
290
|
|
|
526
|
-
|
|
291
|
+
Yama V2 uses MCP (Model Context Protocol) servers for tool access:
|
|
527
292
|
|
|
528
|
-
|
|
529
|
-
# Enterprise setup
|
|
530
|
-
requiredSections:
|
|
531
|
-
- key: "summary"
|
|
532
|
-
name: "📝 Executive Summary"
|
|
533
|
-
required: true
|
|
534
|
-
|
|
535
|
-
- key: "business_impact"
|
|
536
|
-
name: "💼 Business Impact"
|
|
537
|
-
required: true
|
|
538
|
-
|
|
539
|
-
- key: "technical_changes"
|
|
540
|
-
name: "🔧 Technical Changes"
|
|
541
|
-
required: true
|
|
542
|
-
|
|
543
|
-
- key: "testing_strategy"
|
|
544
|
-
name: "🧪 Testing Strategy"
|
|
545
|
-
required: true
|
|
546
|
-
|
|
547
|
-
- key: "rollback_plan"
|
|
548
|
-
name: "🔄 Rollback Plan"
|
|
549
|
-
required: true
|
|
550
|
-
|
|
551
|
-
- key: "monitoring"
|
|
552
|
-
name: "📊 Monitoring & Alerts"
|
|
553
|
-
required: false
|
|
554
|
-
|
|
555
|
-
- key: "documentation"
|
|
556
|
-
name: "📖 Documentation Updates"
|
|
557
|
-
required: false
|
|
558
|
-
```
|
|
293
|
+
### Bitbucket MCP
|
|
559
294
|
|
|
560
|
-
|
|
295
|
+
- **Package**: `@anthropic/bitbucket-mcp-server`
|
|
296
|
+
- **Tools**: get_pull_request, add_comment, search_code, etc.
|
|
297
|
+
- **Status**: Production ready
|
|
561
298
|
|
|
562
|
-
|
|
563
|
-
// Smart pattern matching for existing sections
|
|
564
|
-
const sectionPatterns = {
|
|
565
|
-
changelog: [
|
|
566
|
-
/##.*?[Cc]hangelog/i,
|
|
567
|
-
/##.*?[Mm]odules?\s+[Mm]odified/i,
|
|
568
|
-
/📋.*?[Cc]hangelog/i,
|
|
569
|
-
],
|
|
570
|
-
testcases: [/##.*?[Tt]est\s+[Cc]ases?/i, /##.*?[Tt]esting/i, /🧪.*?[Tt]est/i],
|
|
571
|
-
security: [/##.*?[Ss]ecurity/i, /🔒.*?[Ss]ecurity/i, /##.*?[Vv]ulnerabilit/i],
|
|
572
|
-
};
|
|
573
|
-
```
|
|
299
|
+
### Jira MCP
|
|
574
300
|
|
|
575
|
-
|
|
301
|
+
- **Package**: `@nexus2520/jira-mcp-server`
|
|
302
|
+
- **Tools**: get_issue, search_issues, get_issue_comments
|
|
303
|
+
- **Status**: Optional integration
|
|
576
304
|
|
|
577
|
-
##
|
|
305
|
+
## Monitoring & Analytics
|
|
578
306
|
|
|
579
|
-
|
|
307
|
+
Track review performance with Langfuse integration:
|
|
580
308
|
|
|
581
309
|
```bash
|
|
582
|
-
#
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
# Output:
|
|
586
|
-
# ⚔️ Yama Status
|
|
587
|
-
# ✅ Overall Health: Healthy
|
|
588
|
-
#
|
|
589
|
-
# 📊 Component Status:
|
|
590
|
-
# ✅ ai: OK
|
|
591
|
-
# ✅ git: OK
|
|
592
|
-
# ✅ cache: OK
|
|
593
|
-
# ✅ config: OK
|
|
594
|
-
#
|
|
595
|
-
# 📈 Statistics:
|
|
596
|
-
# {
|
|
597
|
-
# "totalOperations": 45,
|
|
598
|
-
# "successRate": 0.98,
|
|
599
|
-
# "avgProcessingTime": 120,
|
|
600
|
-
# "apiCallsSaved": 1250
|
|
601
|
-
# }
|
|
602
|
-
#
|
|
603
|
-
# 💾 Cache: 67 keys, 423 hits, 89% hit ratio
|
|
310
|
+
# Set Langfuse environment variables
|
|
311
|
+
export LANGFUSE_PUBLIC_KEY=your-public-key
|
|
312
|
+
export LANGFUSE_SECRET_KEY=your-secret-key
|
|
604
313
|
```
|
|
605
314
|
|
|
606
|
-
|
|
315
|
+
Analytics include:
|
|
607
316
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
# 💾 Cache Statistics
|
|
614
|
-
# Keys: 67
|
|
615
|
-
# Hits: 423
|
|
616
|
-
# Misses: 52
|
|
617
|
-
# Hit Ratio: 89%
|
|
618
|
-
#
|
|
619
|
-
# 📊 Detailed Stats:
|
|
620
|
-
# {
|
|
621
|
-
# "pr": { "hits": 45, "misses": 5 },
|
|
622
|
-
# "file-diff": { "hits": 234, "misses": 28 },
|
|
623
|
-
# "context": { "hits": 144, "misses": 19 }
|
|
624
|
-
# }
|
|
625
|
-
|
|
626
|
-
# Clear caches
|
|
627
|
-
yama cache clear
|
|
628
|
-
```
|
|
317
|
+
- Tool calls made
|
|
318
|
+
- Token usage
|
|
319
|
+
- Cost estimate
|
|
320
|
+
- Duration
|
|
321
|
+
- Decision rationale
|
|
629
322
|
|
|
630
|
-
|
|
323
|
+
## Troubleshooting
|
|
324
|
+
|
|
325
|
+
### MCP Server Connection Issues
|
|
631
326
|
|
|
632
327
|
```bash
|
|
633
|
-
#
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
yama config show
|
|
638
|
-
|
|
639
|
-
# Output:
|
|
640
|
-
# ⚙️ Current Configuration
|
|
641
|
-
# {
|
|
642
|
-
# "ai": {
|
|
643
|
-
# "provider": "google-ai",
|
|
644
|
-
# "enableAnalytics": true
|
|
645
|
-
# },
|
|
646
|
-
# "git": {
|
|
647
|
-
# "platform": "bitbucket",
|
|
648
|
-
# "credentials": {
|
|
649
|
-
# "token": "***MASKED***"
|
|
650
|
-
# }
|
|
651
|
-
# }
|
|
652
|
-
# }
|
|
328
|
+
# Verify environment variables
|
|
329
|
+
echo $BITBUCKET_USERNAME
|
|
330
|
+
echo $BITBUCKET_APP_PASSWORD
|
|
331
|
+
echo $BITBUCKET_BASE_URL
|
|
653
332
|
```
|
|
654
333
|
|
|
655
|
-
|
|
334
|
+
### AI Not Finding Issues
|
|
656
335
|
|
|
657
|
-
|
|
336
|
+
- Check `focusAreas` in config
|
|
337
|
+
- Verify `blockingCriteria` are clear
|
|
338
|
+
- Ensure `temperature` is low (0.2-0.3)
|
|
339
|
+
- Review project-specific standards in memory-bank
|
|
658
340
|
|
|
659
|
-
|
|
341
|
+
### High Token Usage
|
|
660
342
|
|
|
661
|
-
|
|
343
|
+
- Enable `lazyLoading: true` in config
|
|
344
|
+
- Reduce `maxFilesPerReview`
|
|
345
|
+
- Set `maxToolCallsPerFile` limit
|
|
346
|
+
- Use `excludePatterns` to skip generated files
|
|
662
347
|
|
|
663
|
-
|
|
664
|
-
# Old way
|
|
665
|
-
node pr-police.js --workspace YOUR_WORKSPACE --repository repo --branch branch
|
|
348
|
+
## Performance
|
|
666
349
|
|
|
667
|
-
|
|
668
|
-
yama review --workspace YOUR_WORKSPACE --repository repo --branch branch
|
|
350
|
+
### Expected Metrics
|
|
669
351
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
352
|
+
| Metric | Target |
|
|
353
|
+
| --------------- | --------------------- |
|
|
354
|
+
| Review time | < 10 min for 20 files |
|
|
355
|
+
| Token usage | < 500K per review |
|
|
356
|
+
| Cost per review | < $2 USD |
|
|
357
|
+
| Accuracy | > 95% of V1 findings |
|
|
673
358
|
|
|
674
|
-
###
|
|
359
|
+
### Optimization Tips
|
|
675
360
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
361
|
+
1. **Use lazy loading** - Don't pre-fetch everything
|
|
362
|
+
2. **Cache tool results** - Reuse MCP responses
|
|
363
|
+
3. **Exclude generated files** - Skip lock files, minified code
|
|
364
|
+
4. **Limit file count** - Split large PRs
|
|
679
365
|
|
|
680
|
-
|
|
681
|
-
yama enhance --workspace YOUR_WORKSPACE --repository repo --branch branch
|
|
366
|
+
## Migration from V1
|
|
682
367
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
368
|
+
**Breaking Change**: V1 has been completely replaced by V2. There is no backward compatibility.
|
|
369
|
+
|
|
370
|
+
### Automated Config Migration
|
|
686
371
|
|
|
687
|
-
|
|
372
|
+
Use the built-in migration script to convert your V1 config to V2 format:
|
|
688
373
|
|
|
689
374
|
```bash
|
|
690
|
-
#
|
|
691
|
-
yama
|
|
692
|
-
```
|
|
375
|
+
# Rename your current config to V1
|
|
376
|
+
mv yama.config.yaml yama.v1.config.yaml
|
|
693
377
|
|
|
694
|
-
|
|
378
|
+
# Run migration (dry-run first to preview)
|
|
379
|
+
npx yama migrate-config --dry-run
|
|
695
380
|
|
|
696
|
-
|
|
381
|
+
# Run actual migration
|
|
382
|
+
npx yama migrate-config
|
|
697
383
|
|
|
384
|
+
# Or with custom paths
|
|
385
|
+
npx yama migrate-config \
|
|
386
|
+
--input yama.v1.config.yaml \
|
|
387
|
+
--output yama.config.yaml \
|
|
388
|
+
--force
|
|
698
389
|
```
|
|
699
|
-
⚔️ YAMA ARCHITECTURE ⚔️
|
|
700
|
-
┌─────────────────────────────────────────────────────────────┐
|
|
701
|
-
│ 🔍 UNIFIED CONTEXT GATHERING (Once for all operations) │
|
|
702
|
-
│ ├── 🔍 Find Open PR (by branch or PR ID) │
|
|
703
|
-
│ ├── 📄 Get PR Details (title, description, comments) │
|
|
704
|
-
│ ├── 🧠 Get Memory Bank Context (project rules) │
|
|
705
|
-
│ ├── 📊 Smart Diff Strategy (whole vs file-by-file) │
|
|
706
|
-
│ └── 📎 Apply File Exclusions & Filters │
|
|
707
|
-
├─────────────────────────────────────────────────────────────┤
|
|
708
|
-
│ ⚡ OPTIMIZED OPERATIONS (Use shared context) │
|
|
709
|
-
│ ├── 🛡️ Code Review (security, performance, quality) │
|
|
710
|
-
│ ├── 📝 Description Enhancement (preserve + enhance) │
|
|
711
|
-
│ ├── 🔒 Security Scan (future) │
|
|
712
|
-
│ └── 📊 Analytics & Reporting (future) │
|
|
713
|
-
├─────────────────────────────────────────────────────────────┤
|
|
714
|
-
│ 🚀 PERFORMANCE LAYER │
|
|
715
|
-
│ ├── 💾 Multi-Layer Caching (90% fewer API calls) │
|
|
716
|
-
│ ├── 🔗 Connection Reuse (single MCP connection) │
|
|
717
|
-
│ ├── 📦 Intelligent Batching (5 files per batch) │
|
|
718
|
-
│ └── 🔄 Smart Retry Logic (exponential backoff) │
|
|
719
|
-
└─────────────────────────────────────────────────────────────┘
|
|
720
|
-
```
|
|
721
|
-
|
|
722
|
-
---
|
|
723
|
-
|
|
724
|
-
## 🌟 **Why Yama?**
|
|
725
390
|
|
|
726
|
-
|
|
391
|
+
The migration script will:
|
|
727
392
|
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
7. **🔄 Backward Compatible**: Existing workflows work unchanged
|
|
393
|
+
- ✅ Migrate AI provider settings
|
|
394
|
+
- ✅ Convert focus areas to structured format
|
|
395
|
+
- ✅ Transform required sections with descriptions
|
|
396
|
+
- ✅ Apply V2 defaults for new features
|
|
397
|
+
- ⚠️ Warn about dropped V1 features (batchProcessing, multiInstance, etc.)
|
|
398
|
+
- 📊 Generate a detailed migration report
|
|
735
399
|
|
|
736
|
-
###
|
|
400
|
+
### V1 → V2 Migration Steps
|
|
737
401
|
|
|
738
|
-
1.
|
|
739
|
-
2. **🔒 Security-First**: Built-in security analysis and hardcoded secret detection
|
|
740
|
-
3. **🤖 AI-Native**: Deep integration with multiple AI providers with fallbacks
|
|
741
|
-
4. **⚙️ Highly Configurable**: Every aspect can be customized via configuration
|
|
742
|
-
5. **📊 Analytics Ready**: Built-in performance monitoring and metrics collection
|
|
402
|
+
1. **Migrate configuration** (automated):
|
|
743
403
|
|
|
744
|
-
|
|
404
|
+
```bash
|
|
405
|
+
npx yama migrate-config
|
|
406
|
+
```
|
|
745
407
|
|
|
746
|
-
|
|
408
|
+
2. **Update imports**:
|
|
747
409
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
- **🚫 No Tracking**: No usage analytics sent to external services (unless explicitly enabled)
|
|
752
|
-
- **🛡️ Content Filtering**: Automatic detection and filtering of sensitive data before AI processing
|
|
410
|
+
```typescript
|
|
411
|
+
// V1 (removed)
|
|
412
|
+
// import { Guardian } from "@juspay/yama";
|
|
753
413
|
|
|
754
|
-
|
|
414
|
+
// V2 (use this)
|
|
415
|
+
import { createYamaV2 } from "@juspay/yama";
|
|
416
|
+
const yama = createYamaV2();
|
|
417
|
+
```
|
|
755
418
|
|
|
756
|
-
|
|
419
|
+
3. **Set environment variables**: V2 uses MCP servers configured via env vars
|
|
757
420
|
|
|
758
|
-
|
|
421
|
+
```bash
|
|
422
|
+
# Bitbucket (required)
|
|
423
|
+
export BITBUCKET_USERNAME=your.email@company.com
|
|
424
|
+
export BITBUCKET_APP_PASSWORD=your-http-access-token
|
|
425
|
+
export BITBUCKET_BASE_URL=https://bitbucket.yourcompany.com
|
|
759
426
|
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
performance: {
|
|
765
|
-
totalOperations: stats.totalOperations,
|
|
766
|
-
avgProcessingTime: stats.avgProcessingTime,
|
|
767
|
-
successRate: stats.successRate,
|
|
768
|
-
apiCallsSaved: stats.apiCallsSaved,
|
|
769
|
-
},
|
|
770
|
-
cache: {
|
|
771
|
-
hitRatio: stats.cache.hitRatio,
|
|
772
|
-
totalHits: stats.cache.hits,
|
|
773
|
-
keyCount: stats.cache.keys,
|
|
774
|
-
},
|
|
775
|
-
resources: {
|
|
776
|
-
memoryUsage: stats.memory,
|
|
777
|
-
activeConnections: stats.connections,
|
|
778
|
-
},
|
|
779
|
-
});
|
|
427
|
+
# Jira (optional)
|
|
428
|
+
export JIRA_EMAIL=your-email@company.com
|
|
429
|
+
export JIRA_API_TOKEN=your-jira-api-token
|
|
430
|
+
export JIRA_BASE_URL=https://yourcompany.atlassian.net
|
|
780
431
|
```
|
|
781
432
|
|
|
782
|
-
|
|
433
|
+
4. **Test thoroughly**: V2 uses autonomous AI orchestration - validate behavior in dry-run mode first
|
|
783
434
|
|
|
784
435
|
```bash
|
|
785
|
-
|
|
786
|
-
yama status --detailed
|
|
787
|
-
|
|
788
|
-
# Example output shows:
|
|
789
|
-
# - 90% reduction in API calls vs individual scripts
|
|
790
|
-
# - 3x faster execution through shared context
|
|
791
|
-
# - 89% cache hit ratio
|
|
792
|
-
# - Average processing time: 2.3 minutes for medium PRs
|
|
436
|
+
npx yama review --workspace YOUR_WORKSPACE --repository my-repo --pr 123 --dry-run
|
|
793
437
|
```
|
|
794
438
|
|
|
795
|
-
|
|
439
|
+
### What Gets Migrated
|
|
796
440
|
|
|
797
|
-
|
|
441
|
+
| V1 Section | V2 Section | Notes |
|
|
442
|
+
| --------------------------------- | ------------------------ | ------------------------ |
|
|
443
|
+
| `providers.ai` | `ai` | Direct mapping |
|
|
444
|
+
| `features.codeReview` | `review` | Restructured |
|
|
445
|
+
| `features.descriptionEnhancement` | `descriptionEnhancement` | Restructured |
|
|
446
|
+
| `monitoring` | `monitoring` | Enhanced |
|
|
447
|
+
| `rules` | `projectStandards` | Converted to focus areas |
|
|
798
448
|
|
|
799
|
-
|
|
800
|
-
- **🌐 Multi-Platform Support**: GitHub, GitLab, Azure DevOps integration
|
|
801
|
-
- **📊 Advanced Analytics**: Team productivity metrics, code quality trends
|
|
802
|
-
- **🤖 Custom AI Rules**: Train models on your codebase patterns
|
|
803
|
-
- **⚡ Parallel Processing**: Multi-PR batch processing for CI/CD integration
|
|
804
|
-
- **🔗 IDE Integration**: VSCode, IntelliJ plugins for real-time analysis
|
|
449
|
+
### What Gets Dropped
|
|
805
450
|
|
|
806
|
-
|
|
451
|
+
These V1 features are **removed** in V2 (AI handles autonomously):
|
|
452
|
+
|
|
453
|
+
- `providers.git` → Use environment variables
|
|
454
|
+
- `features.codeReview.batchProcessing` → AI manages batching
|
|
455
|
+
- `features.codeReview.multiInstance` → Single autonomous agent
|
|
456
|
+
- `features.codeReview.semanticDeduplication` → AI deduplicates naturally
|
|
457
|
+
- `features.securityScan` → Built into AI prompts
|
|
458
|
+
- `cache` → MCP tools handle caching
|
|
807
459
|
|
|
808
|
-
##
|
|
460
|
+
## Contributing
|
|
809
461
|
|
|
810
462
|
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
811
463
|
|
|
@@ -815,42 +467,16 @@ We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) f
|
|
|
815
467
|
4. **Push** to the branch (`git push origin feature/amazing-feature`)
|
|
816
468
|
5. **Open** a Pull Request
|
|
817
469
|
|
|
818
|
-
|
|
470
|
+
## Support
|
|
819
471
|
|
|
820
|
-
|
|
472
|
+
- **Documentation**: [GitHub Wiki](https://github.com/juspay/yama/wiki)
|
|
473
|
+
- **Issues**: [GitHub Issues](https://github.com/juspay/yama/issues)
|
|
474
|
+
- **Discussions**: [GitHub Discussions](https://github.com/juspay/yama/discussions)
|
|
821
475
|
|
|
822
|
-
|
|
476
|
+
## License
|
|
823
477
|
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
## 🆘 **Support**
|
|
827
|
-
|
|
828
|
-
- **📖 Documentation**: [GitHub Wiki](https://github.com/juspay/yama/wiki)
|
|
829
|
-
- **🐛 Issues**: [GitHub Issues](https://github.com/juspay/yama/issues)
|
|
830
|
-
- **💬 Discussions**: [GitHub Discussions](https://github.com/juspay/yama/discussions)
|
|
831
|
-
- **📧 Email**: opensource@juspay.in
|
|
478
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
832
479
|
|
|
833
480
|
---
|
|
834
481
|
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
```bash
|
|
838
|
-
# Required
|
|
839
|
-
BITBUCKET_USERNAME=your-username
|
|
840
|
-
BITBUCKET_TOKEN=your-personal-access-token
|
|
841
|
-
GOOGLE_AI_API_KEY=your-google-ai-api-key
|
|
842
|
-
|
|
843
|
-
# Optional
|
|
844
|
-
BITBUCKET_BASE_URL=https://your-bitbucket-server.com
|
|
845
|
-
AI_PROVIDER=google-ai
|
|
846
|
-
AI_MODEL=gemini-2.5-pro
|
|
847
|
-
DEFAULT_WORKSPACE=YOUR_WORKSPACE
|
|
848
|
-
ENABLE_CACHE=true
|
|
849
|
-
YAMA_DEBUG=false
|
|
850
|
-
```
|
|
851
|
-
|
|
852
|
-
---
|
|
853
|
-
|
|
854
|
-
**⚔️ Built with ❤️ by the Juspay team • Powered by AI & Enterprise Security • Code Quality Justice**
|
|
855
|
-
|
|
856
|
-
> _"In the realm of code, Yama stands as the eternal judge, ensuring only the worthy changes pass through to enlightenment."_
|
|
482
|
+
**⚔️ Built with ❤️ by Juspay • Powered by AI & MCP • Autonomous Code Quality Justice**
|