@juspay/yama 1.1.0 โ 1.1.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/CHANGELOG.md +27 -1
- package/README.md +151 -119
- package/dist/cli/index.js +201 -200
- package/dist/core/ContextGatherer.d.ts +3 -3
- package/dist/core/ContextGatherer.js +145 -149
- package/dist/core/Guardian.d.ts +1 -1
- package/dist/core/Guardian.js +122 -122
- package/dist/core/providers/BitbucketProvider.d.ts +3 -3
- package/dist/core/providers/BitbucketProvider.js +129 -121
- package/dist/features/CodeReviewer.d.ts +3 -3
- package/dist/features/CodeReviewer.js +290 -221
- package/dist/features/DescriptionEnhancer.d.ts +3 -3
- package/dist/features/DescriptionEnhancer.js +115 -94
- package/dist/index.d.ts +11 -11
- package/dist/index.js +10 -48
- package/dist/types/index.d.ts +21 -21
- package/dist/types/index.js +13 -18
- package/dist/utils/Cache.d.ts +1 -1
- package/dist/utils/Cache.js +62 -68
- package/dist/utils/ConfigManager.d.ts +1 -1
- package/dist/utils/ConfigManager.js +281 -253
- package/dist/utils/Logger.d.ts +2 -2
- package/dist/utils/Logger.js +69 -67
- package/package.json +7 -6
- package/yama.config.example.yaml +28 -21
package/README.md
CHANGED
|
@@ -17,25 +17,29 @@ Yama is the **code quality judge** that combines and optimizes the functionality
|
|
|
17
17
|
## โจ **Core Features**
|
|
18
18
|
|
|
19
19
|
### ๐ **AI-Powered Code Review**
|
|
20
|
+
|
|
20
21
|
- **๐ Security Analysis**: SQL injection, XSS, hardcoded secrets detection
|
|
21
|
-
- **โก Performance Review**: N+1 queries, memory leaks, algorithm efficiency
|
|
22
|
+
- **โก Performance Review**: N+1 queries, memory leaks, algorithm efficiency
|
|
22
23
|
- **๐๏ธ Code Quality**: SOLID principles, maintainability, best practices
|
|
23
24
|
- **๐ฌ Smart Comments**: Contextual inline comments with actionable suggestions
|
|
24
25
|
- **๐ Severity Levels**: CRITICAL, MAJOR, MINOR, SUGGESTION with intelligent categorization
|
|
25
26
|
|
|
26
27
|
### ๐ **Intelligent Description Enhancement**
|
|
28
|
+
|
|
27
29
|
- **๐ Content Preservation**: Never removes screenshots, links, or existing explanations
|
|
28
30
|
- **๐ Required Sections**: Configurable sections (Changelog, Test Cases, Config Changes, etc.)
|
|
29
31
|
- **๐ค AI Enhancement**: Automatically improves incomplete descriptions while preserving content
|
|
30
32
|
- **๐ง Project Context**: Uses memory-bank and .clinerules for contextual enhancement
|
|
31
33
|
|
|
32
34
|
### ๐ **Unified Context System** (Core Innovation)
|
|
35
|
+
|
|
33
36
|
- **โก One-Time Gathering**: Collect all PR context once, reuse across all operations
|
|
34
37
|
- **๐ง Smart Diff Strategy**: Automatically chooses whole diff vs file-by-file based on PR size
|
|
35
38
|
- **๐พ Intelligent Caching**: 90% reduction in API calls through multi-layer caching
|
|
36
39
|
- **๐ฆ Batch Processing**: Process large PRs efficiently with intelligent file batching
|
|
37
40
|
|
|
38
41
|
### ๐๏ธ **Enterprise Ready**
|
|
42
|
+
|
|
39
43
|
- **๐ Multi-Platform**: Bitbucket Server (Phase 1), GitHub/GitLab (Future phases)
|
|
40
44
|
- **๐ Full TypeScript**: Complete type safety and excellent developer experience
|
|
41
45
|
- **โ๏ธ Highly Configurable**: YAML/JSON configuration with validation and hot-reload
|
|
@@ -45,13 +49,13 @@ Yama is the **code quality judge** that combines and optimizes the functionality
|
|
|
45
49
|
|
|
46
50
|
## ๐ **Performance Benefits**
|
|
47
51
|
|
|
48
|
-
| Metric
|
|
49
|
-
|
|
50
|
-
| **API Calls**
|
|
51
|
-
| **Execution Time**
|
|
52
|
-
| **Memory Usage**
|
|
53
|
-
| **Cache Efficiency**
|
|
54
|
-
| **Large PRs (40+ files)** | Often fails/timeouts
|
|
52
|
+
| Metric | Individual Scripts | Yama | Improvement |
|
|
53
|
+
| ------------------------- | --------------------- | -------------------- | ----------------------- |
|
|
54
|
+
| **API Calls** | ~50-100 per operation | ~10-20 total | **90% reduction** |
|
|
55
|
+
| **Execution Time** | 3-5 minutes each | 2-3 minutes total | **3x faster** |
|
|
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** |
|
|
55
59
|
|
|
56
60
|
---
|
|
57
61
|
|
|
@@ -70,6 +74,7 @@ npm install @juspay/yama
|
|
|
70
74
|
## โก **Quick Start**
|
|
71
75
|
|
|
72
76
|
### **1. Initialize Configuration**
|
|
77
|
+
|
|
73
78
|
```bash
|
|
74
79
|
# Interactive setup
|
|
75
80
|
yama init --interactive
|
|
@@ -81,6 +86,7 @@ yama init
|
|
|
81
86
|
### **2. Basic Usage**
|
|
82
87
|
|
|
83
88
|
#### **Unified Processing (Recommended)**
|
|
89
|
+
|
|
84
90
|
```bash
|
|
85
91
|
# Process PR with both review and description enhancement
|
|
86
92
|
yama process --workspace YOUR_WORKSPACE --repository my-repo --branch feature/auth
|
|
@@ -90,15 +96,17 @@ yama process --workspace YOUR_WORKSPACE --repository my-repo --branch feature/au
|
|
|
90
96
|
```
|
|
91
97
|
|
|
92
98
|
#### **Individual Operations**
|
|
99
|
+
|
|
93
100
|
```bash
|
|
94
101
|
# Code review only
|
|
95
102
|
yama review --workspace YOUR_WORKSPACE --repository my-repo --branch feature/auth
|
|
96
103
|
|
|
97
|
-
# Description enhancement only
|
|
104
|
+
# Description enhancement only
|
|
98
105
|
yama enhance --workspace YOUR_WORKSPACE --repository my-repo --branch feature/auth
|
|
99
106
|
```
|
|
100
107
|
|
|
101
108
|
#### **Backward Compatibility**
|
|
109
|
+
|
|
102
110
|
```bash
|
|
103
111
|
# Still works exactly like pr-police.js
|
|
104
112
|
yama police --workspace YOUR_WORKSPACE --repository my-repo --branch feature/auth
|
|
@@ -112,6 +120,7 @@ yama scribe --workspace YOUR_WORKSPACE --repository my-repo --branch feature/aut
|
|
|
112
120
|
## ๐ง **Advanced Configuration**
|
|
113
121
|
|
|
114
122
|
### **File Exclusion Patterns**
|
|
123
|
+
|
|
115
124
|
```bash
|
|
116
125
|
# Exclude specific file types and directories
|
|
117
126
|
yama process \
|
|
@@ -126,6 +135,7 @@ yama enhance --exclude "*.md" # Don't process existing markdown files
|
|
|
126
135
|
```
|
|
127
136
|
|
|
128
137
|
### **Context and Performance Tuning**
|
|
138
|
+
|
|
129
139
|
```bash
|
|
130
140
|
# More context lines for better AI analysis
|
|
131
141
|
yama review --context-lines 5 --exclude "*.lock"
|
|
@@ -144,9 +154,9 @@ yama process --force-refresh
|
|
|
144
154
|
Create `yama.config.yaml` in your project root:
|
|
145
155
|
|
|
146
156
|
```yaml
|
|
147
|
-
# AI Provider Configuration
|
|
157
|
+
# AI Provider Configuration
|
|
148
158
|
ai:
|
|
149
|
-
provider: "auto"
|
|
159
|
+
provider: "auto" # auto, google-ai, openai, anthropic
|
|
150
160
|
enableFallback: true
|
|
151
161
|
enableAnalytics: true
|
|
152
162
|
timeout: "5m"
|
|
@@ -166,7 +176,7 @@ features:
|
|
|
166
176
|
codeReview:
|
|
167
177
|
enabled: true
|
|
168
178
|
severityLevels: ["CRITICAL", "MAJOR", "MINOR", "SUGGESTION"]
|
|
169
|
-
excludePatterns:
|
|
179
|
+
excludePatterns:
|
|
170
180
|
- "*.lock"
|
|
171
181
|
- "*.svg"
|
|
172
182
|
- "*.min.js"
|
|
@@ -175,76 +185,76 @@ features:
|
|
|
175
185
|
- "build/**"
|
|
176
186
|
- "coverage/**"
|
|
177
187
|
contextLines: 3
|
|
178
|
-
|
|
188
|
+
|
|
179
189
|
# Custom AI Prompts for Code Review (Advanced)
|
|
180
190
|
systemPrompt: |
|
|
181
191
|
You are an Expert Security Code Reviewer focusing on enterprise standards.
|
|
182
192
|
Prioritize security vulnerabilities, performance issues, and code quality.
|
|
183
193
|
Provide actionable feedback with specific examples and solutions.
|
|
184
|
-
|
|
194
|
+
|
|
185
195
|
focusAreas:
|
|
186
196
|
- "๐ Security Analysis (CRITICAL PRIORITY)"
|
|
187
|
-
- "โก Performance Review"
|
|
197
|
+
- "โก Performance Review"
|
|
188
198
|
- "๐๏ธ Code Quality & Best Practices"
|
|
189
199
|
- "๐งช Testing & Error Handling"
|
|
190
200
|
- "๐ Documentation & Maintainability"
|
|
191
|
-
|
|
201
|
+
|
|
192
202
|
descriptionEnhancement:
|
|
193
203
|
enabled: true
|
|
194
|
-
preserveContent: true
|
|
204
|
+
preserveContent: true # NEVER remove existing content
|
|
195
205
|
requiredSections:
|
|
196
206
|
# Default sections
|
|
197
207
|
- key: "changelog"
|
|
198
208
|
name: "๐ Changelog (Modules Modified)"
|
|
199
209
|
required: true
|
|
200
|
-
|
|
210
|
+
|
|
201
211
|
- key: "testcases"
|
|
202
212
|
name: "๐งช Test Cases (What to be tested)"
|
|
203
213
|
required: true
|
|
204
|
-
|
|
214
|
+
|
|
205
215
|
- key: "config_changes"
|
|
206
216
|
name: "โ๏ธ Config Changes (CAC/Service Config)"
|
|
207
217
|
required: true
|
|
208
|
-
|
|
218
|
+
|
|
209
219
|
# Optional custom sections
|
|
210
220
|
- key: "breaking_changes"
|
|
211
221
|
name: "โ ๏ธ Breaking Changes"
|
|
212
222
|
required: false
|
|
213
|
-
|
|
223
|
+
|
|
214
224
|
- key: "migration_notes"
|
|
215
225
|
name: "๐ Migration Notes"
|
|
216
226
|
required: false
|
|
217
|
-
|
|
227
|
+
|
|
218
228
|
- key: "performance_impact"
|
|
219
229
|
name: "โก Performance Impact"
|
|
220
230
|
required: false
|
|
221
|
-
|
|
231
|
+
|
|
222
232
|
- key: "security_considerations"
|
|
223
233
|
name: "๐ Security Considerations"
|
|
224
234
|
required: false
|
|
225
|
-
|
|
235
|
+
|
|
226
236
|
# Custom AI Prompts and Templates (Advanced)
|
|
227
237
|
systemPrompt: |
|
|
228
238
|
You are an Expert Technical Writer specializing in pull request documentation.
|
|
229
239
|
Focus on clarity, completeness, and helping reviewers understand the changes.
|
|
230
240
|
CRITICAL: Return ONLY the enhanced description without meta-commentary.
|
|
231
|
-
|
|
241
|
+
|
|
232
242
|
enhancementInstructions: |
|
|
233
243
|
Return ONLY the enhanced PR description as clean markdown.
|
|
234
244
|
Start directly with the enhanced description content.
|
|
235
|
-
|
|
245
|
+
|
|
236
246
|
outputTemplate: |
|
|
237
247
|
# {{PR_TITLE}}
|
|
238
|
-
|
|
248
|
+
|
|
239
249
|
## Summary
|
|
240
250
|
[Clear overview of what this PR accomplishes]
|
|
241
|
-
|
|
251
|
+
|
|
242
252
|
## Changes Made
|
|
243
253
|
[Specific technical changes with file references]
|
|
244
|
-
|
|
254
|
+
|
|
245
255
|
## Testing Strategy
|
|
246
256
|
[How changes were tested and validated]
|
|
247
|
-
|
|
257
|
+
|
|
248
258
|
## Impact & Considerations
|
|
249
259
|
[Business impact, performance implications, breaking changes]
|
|
250
260
|
|
|
@@ -266,25 +276,26 @@ monitoring:
|
|
|
266
276
|
## ๐ค **Programmatic Usage**
|
|
267
277
|
|
|
268
278
|
### **Basic Setup**
|
|
279
|
+
|
|
269
280
|
```typescript
|
|
270
|
-
import { Guardian, createGuardian } from
|
|
281
|
+
import { Guardian, createGuardian } from "@juspay/yama";
|
|
271
282
|
|
|
272
283
|
// Create Guardian instance
|
|
273
284
|
const guardian = createGuardian({
|
|
274
285
|
providers: {
|
|
275
286
|
ai: {
|
|
276
|
-
provider:
|
|
277
|
-
enableAnalytics: true
|
|
287
|
+
provider: "google-ai",
|
|
288
|
+
enableAnalytics: true,
|
|
278
289
|
},
|
|
279
290
|
git: {
|
|
280
|
-
platform:
|
|
291
|
+
platform: "bitbucket",
|
|
281
292
|
credentials: {
|
|
282
293
|
username: process.env.BITBUCKET_USERNAME!,
|
|
283
294
|
token: process.env.BITBUCKET_TOKEN!,
|
|
284
|
-
baseUrl:
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
295
|
+
baseUrl: "https://your-bitbucket-server.com",
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
},
|
|
288
299
|
});
|
|
289
300
|
|
|
290
301
|
// Initialize
|
|
@@ -292,13 +303,14 @@ await guardian.initialize();
|
|
|
292
303
|
```
|
|
293
304
|
|
|
294
305
|
### **Unified Processing**
|
|
306
|
+
|
|
295
307
|
```typescript
|
|
296
308
|
// Process PR with multiple operations using shared context
|
|
297
309
|
const result = await guardian.processPR({
|
|
298
|
-
workspace:
|
|
299
|
-
repository:
|
|
300
|
-
branch:
|
|
301
|
-
operations: [
|
|
310
|
+
workspace: "YOUR_WORKSPACE",
|
|
311
|
+
repository: "my-repo",
|
|
312
|
+
branch: "feature/auth",
|
|
313
|
+
operations: ["review", "enhance-description"],
|
|
302
314
|
});
|
|
303
315
|
|
|
304
316
|
console.log(`Processed ${result.operations.length} operations`);
|
|
@@ -307,16 +319,17 @@ console.log(`Cache hit ratio: ${result.performance.cacheHitRatio}%`);
|
|
|
307
319
|
```
|
|
308
320
|
|
|
309
321
|
### **Streaming Processing with Real-time Updates**
|
|
322
|
+
|
|
310
323
|
```typescript
|
|
311
324
|
// Real-time progress updates
|
|
312
325
|
for await (const update of guardian.processPRStream({
|
|
313
|
-
workspace:
|
|
314
|
-
repository:
|
|
315
|
-
branch:
|
|
316
|
-
operations: [
|
|
326
|
+
workspace: "YOUR_WORKSPACE",
|
|
327
|
+
repository: "my-repo",
|
|
328
|
+
branch: "feature/auth",
|
|
329
|
+
operations: ["review", "enhance-description"],
|
|
317
330
|
})) {
|
|
318
331
|
console.log(`${update.operation}: ${update.status} - ${update.message}`);
|
|
319
|
-
|
|
332
|
+
|
|
320
333
|
if (update.progress) {
|
|
321
334
|
console.log(`Progress: ${update.progress}%`);
|
|
322
335
|
}
|
|
@@ -324,39 +337,41 @@ for await (const update of guardian.processPRStream({
|
|
|
324
337
|
```
|
|
325
338
|
|
|
326
339
|
### **Individual Operations**
|
|
340
|
+
|
|
327
341
|
```typescript
|
|
328
342
|
// Code review only
|
|
329
343
|
const reviewResult = await guardian.reviewCode({
|
|
330
|
-
workspace:
|
|
331
|
-
repository:
|
|
332
|
-
branch:
|
|
333
|
-
excludePatterns: [
|
|
344
|
+
workspace: "YOUR_WORKSPACE",
|
|
345
|
+
repository: "my-repo",
|
|
346
|
+
branch: "feature/auth",
|
|
347
|
+
excludePatterns: ["*.lock", "*.svg"],
|
|
334
348
|
});
|
|
335
349
|
|
|
336
350
|
// Description enhancement only
|
|
337
351
|
const enhancementResult = await guardian.enhanceDescription({
|
|
338
|
-
workspace:
|
|
339
|
-
repository:
|
|
340
|
-
branch:
|
|
352
|
+
workspace: "YOUR_WORKSPACE",
|
|
353
|
+
repository: "my-repo",
|
|
354
|
+
branch: "feature/auth",
|
|
341
355
|
customSections: [
|
|
342
|
-
{ key:
|
|
343
|
-
{ key:
|
|
344
|
-
]
|
|
356
|
+
{ key: "summary", name: "๐ Summary", required: true },
|
|
357
|
+
{ key: "rollback", name: "๐ Rollback Plan", required: true },
|
|
358
|
+
],
|
|
345
359
|
});
|
|
346
360
|
```
|
|
347
361
|
|
|
348
362
|
### **Configuration Hot-Reload**
|
|
363
|
+
|
|
349
364
|
```typescript
|
|
350
|
-
import { configManager } from
|
|
365
|
+
import { configManager } from "@juspay/yama";
|
|
351
366
|
|
|
352
367
|
// Enable hot-reload for configuration changes
|
|
353
368
|
const stopWatching = configManager.enableHotReload((newConfig) => {
|
|
354
|
-
console.log(
|
|
369
|
+
console.log("Configuration updated:", newConfig);
|
|
355
370
|
// Optionally reinitialize Guardian with new config
|
|
356
371
|
});
|
|
357
372
|
|
|
358
373
|
// Stop watching when done
|
|
359
|
-
process.on(
|
|
374
|
+
process.on("SIGINT", () => {
|
|
360
375
|
stopWatching();
|
|
361
376
|
process.exit(0);
|
|
362
377
|
});
|
|
@@ -369,42 +384,44 @@ process.on('SIGINT', () => {
|
|
|
369
384
|
Yama automatically chooses the optimal diff processing strategy:
|
|
370
385
|
|
|
371
386
|
### **Strategy Selection**
|
|
387
|
+
|
|
372
388
|
```typescript
|
|
373
389
|
// File count โค 5: Whole diff strategy
|
|
374
390
|
if (fileCount <= 5) {
|
|
375
|
-
strategy =
|
|
376
|
-
reason =
|
|
391
|
+
strategy = "whole"; // Fast, provides full context
|
|
392
|
+
reason = "Small PR, whole diff provides better context";
|
|
377
393
|
}
|
|
378
394
|
|
|
379
395
|
// File count 6-20: Still whole diff (manageable)
|
|
380
396
|
else if (fileCount <= 20) {
|
|
381
|
-
strategy =
|
|
382
|
-
reason =
|
|
397
|
+
strategy = "whole";
|
|
398
|
+
reason = "Moderate PR size, whole diff manageable";
|
|
383
399
|
}
|
|
384
400
|
|
|
385
401
|
// File count 21-50: File-by-file with batching
|
|
386
402
|
else if (fileCount <= 50) {
|
|
387
|
-
strategy =
|
|
388
|
-
reason =
|
|
403
|
+
strategy = "file-by-file"; // Batch process 5 files at a time
|
|
404
|
+
reason = "Large PR, file-by-file more efficient";
|
|
389
405
|
}
|
|
390
406
|
|
|
391
407
|
// File count > 50: Essential batching for performance
|
|
392
408
|
else {
|
|
393
|
-
strategy =
|
|
394
|
-
reason =
|
|
409
|
+
strategy = "file-by-file";
|
|
410
|
+
reason = "Very large PR, batching required for performance";
|
|
395
411
|
}
|
|
396
412
|
```
|
|
397
413
|
|
|
398
414
|
### **Batch Processing for Large PRs**
|
|
415
|
+
|
|
399
416
|
```typescript
|
|
400
417
|
// Process files in optimized batches
|
|
401
418
|
const batchSize = 5;
|
|
402
419
|
for (let i = 0; i < filteredFiles.length; i += batchSize) {
|
|
403
420
|
const batch = filteredFiles.slice(i, i + batchSize);
|
|
404
|
-
|
|
421
|
+
|
|
405
422
|
// Process batch in parallel with intelligent caching
|
|
406
423
|
const batchResults = await Promise.all(
|
|
407
|
-
batch.map(file => processFileWithCache(file))
|
|
424
|
+
batch.map((file) => processFileWithCache(file)),
|
|
408
425
|
);
|
|
409
426
|
}
|
|
410
427
|
```
|
|
@@ -414,20 +431,22 @@ for (let i = 0; i < filteredFiles.length; i += batchSize) {
|
|
|
414
431
|
## ๐ฏ **File Exclusion Patterns**
|
|
415
432
|
|
|
416
433
|
### **Built-in Smart Exclusions**
|
|
434
|
+
|
|
417
435
|
```yaml
|
|
418
436
|
# Default exclusions (always applied unless overridden)
|
|
419
437
|
excludePatterns:
|
|
420
|
-
- "*.lock"
|
|
421
|
-
- "*.svg"
|
|
422
|
-
- "*.min.js"
|
|
423
|
-
- "*.min.css"
|
|
424
|
-
- "node_modules/**"
|
|
425
|
-
- "dist/**"
|
|
426
|
-
- "build/**"
|
|
427
|
-
- "coverage/**"
|
|
438
|
+
- "*.lock" # Package lock files
|
|
439
|
+
- "*.svg" # SVG images
|
|
440
|
+
- "*.min.js" # Minified JavaScript
|
|
441
|
+
- "*.min.css" # Minified CSS
|
|
442
|
+
- "node_modules/**" # Dependencies
|
|
443
|
+
- "dist/**" # Build outputs
|
|
444
|
+
- "build/**" # Build outputs
|
|
445
|
+
- "coverage/**" # Test coverage
|
|
428
446
|
```
|
|
429
447
|
|
|
430
448
|
### **Pattern Syntax**
|
|
449
|
+
|
|
431
450
|
```bash
|
|
432
451
|
# Examples of supported patterns:
|
|
433
452
|
--exclude "*.lock" # All lock files
|
|
@@ -438,19 +457,23 @@ excludePatterns:
|
|
|
438
457
|
```
|
|
439
458
|
|
|
440
459
|
### **Context-Aware Exclusions**
|
|
460
|
+
|
|
441
461
|
```typescript
|
|
442
462
|
// Different exclusions for different operations
|
|
443
|
-
const reviewExclusions = [
|
|
444
|
-
const enhancementExclusions = [
|
|
463
|
+
const reviewExclusions = ["*.lock", "*.svg", "**/*.test.js"];
|
|
464
|
+
const enhancementExclusions = ["*.lock"]; // Allow SVGs in descriptions
|
|
445
465
|
|
|
446
466
|
await guardian.processPR({
|
|
447
|
-
operations: [
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
467
|
+
operations: [
|
|
468
|
+
{
|
|
469
|
+
type: "review",
|
|
470
|
+
excludePatterns: reviewExclusions,
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
type: "enhance-description",
|
|
474
|
+
excludePatterns: enhancementExclusions,
|
|
475
|
+
},
|
|
476
|
+
],
|
|
454
477
|
});
|
|
455
478
|
```
|
|
456
479
|
|
|
@@ -459,66 +482,65 @@ await guardian.processPR({
|
|
|
459
482
|
## ๐ **Configurable Description Sections**
|
|
460
483
|
|
|
461
484
|
### **Default Required Sections**
|
|
485
|
+
|
|
462
486
|
```typescript
|
|
463
487
|
const defaultSections = [
|
|
464
|
-
{ key:
|
|
465
|
-
{
|
|
466
|
-
|
|
488
|
+
{ key: "changelog", name: "๐ Changelog (Modules Modified)", required: true },
|
|
489
|
+
{
|
|
490
|
+
key: "testcases",
|
|
491
|
+
name: "๐งช Test Cases (What to be tested)",
|
|
492
|
+
required: true,
|
|
493
|
+
},
|
|
494
|
+
{ key: "config_changes", name: "โ๏ธ Config Changes", required: true },
|
|
467
495
|
];
|
|
468
496
|
```
|
|
469
497
|
|
|
470
498
|
### **Custom Section Examples**
|
|
499
|
+
|
|
471
500
|
```yaml
|
|
472
501
|
# Enterprise setup
|
|
473
502
|
requiredSections:
|
|
474
503
|
- key: "summary"
|
|
475
504
|
name: "๐ Executive Summary"
|
|
476
505
|
required: true
|
|
477
|
-
|
|
506
|
+
|
|
478
507
|
- key: "business_impact"
|
|
479
508
|
name: "๐ผ Business Impact"
|
|
480
509
|
required: true
|
|
481
|
-
|
|
510
|
+
|
|
482
511
|
- key: "technical_changes"
|
|
483
512
|
name: "๐ง Technical Changes"
|
|
484
513
|
required: true
|
|
485
|
-
|
|
514
|
+
|
|
486
515
|
- key: "testing_strategy"
|
|
487
516
|
name: "๐งช Testing Strategy"
|
|
488
517
|
required: true
|
|
489
|
-
|
|
518
|
+
|
|
490
519
|
- key: "rollback_plan"
|
|
491
520
|
name: "๐ Rollback Plan"
|
|
492
521
|
required: true
|
|
493
|
-
|
|
522
|
+
|
|
494
523
|
- key: "monitoring"
|
|
495
524
|
name: "๐ Monitoring & Alerts"
|
|
496
525
|
required: false
|
|
497
|
-
|
|
526
|
+
|
|
498
527
|
- key: "documentation"
|
|
499
528
|
name: "๐ Documentation Updates"
|
|
500
529
|
required: false
|
|
501
530
|
```
|
|
502
531
|
|
|
503
532
|
### **Section Auto-Detection**
|
|
533
|
+
|
|
504
534
|
```typescript
|
|
505
535
|
// Smart pattern matching for existing sections
|
|
506
536
|
const sectionPatterns = {
|
|
507
537
|
changelog: [
|
|
508
538
|
/##.*?[Cc]hangelog/i,
|
|
509
539
|
/##.*?[Mm]odules?\s+[Mm]odified/i,
|
|
510
|
-
/๐.*?[Cc]hangelog/i
|
|
511
|
-
],
|
|
512
|
-
testcases: [
|
|
513
|
-
/##.*?[Tt]est\s+[Cc]ases?/i,
|
|
514
|
-
/##.*?[Tt]esting/i,
|
|
515
|
-
/๐งช.*?[Tt]est/i
|
|
540
|
+
/๐.*?[Cc]hangelog/i,
|
|
516
541
|
],
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
/๐.*?[Ss]ecurity/i,
|
|
520
|
-
/##.*?[Vv]ulnerabilit/i
|
|
521
|
-
]
|
|
542
|
+
testcases: [/##.*?[Tt]est\s+[Cc]ases?/i, /##.*?[Tt]esting/i, /๐งช.*?[Tt]est/i],
|
|
543
|
+
security: [/##.*?[Ss]ecurity/i, /๐.*?[Ss]ecurity/i, /##.*?[Vv]ulnerabilit/i],
|
|
522
544
|
};
|
|
523
545
|
```
|
|
524
546
|
|
|
@@ -527,6 +549,7 @@ const sectionPatterns = {
|
|
|
527
549
|
## ๐ ๏ธ **Utility Commands**
|
|
528
550
|
|
|
529
551
|
### **Health and Status**
|
|
552
|
+
|
|
530
553
|
```bash
|
|
531
554
|
# Check system health
|
|
532
555
|
yama status --detailed
|
|
@@ -534,10 +557,10 @@ yama status --detailed
|
|
|
534
557
|
# Output:
|
|
535
558
|
# โ๏ธ Yama Status
|
|
536
559
|
# โ
Overall Health: Healthy
|
|
537
|
-
#
|
|
560
|
+
#
|
|
538
561
|
# ๐ Component Status:
|
|
539
562
|
# โ
ai: OK
|
|
540
|
-
# โ
git: OK
|
|
563
|
+
# โ
git: OK
|
|
541
564
|
# โ
cache: OK
|
|
542
565
|
# โ
config: OK
|
|
543
566
|
#
|
|
@@ -553,6 +576,7 @@ yama status --detailed
|
|
|
553
576
|
```
|
|
554
577
|
|
|
555
578
|
### **Cache Management**
|
|
579
|
+
|
|
556
580
|
```bash
|
|
557
581
|
# View cache statistics
|
|
558
582
|
yama cache stats
|
|
@@ -576,6 +600,7 @@ yama cache clear
|
|
|
576
600
|
```
|
|
577
601
|
|
|
578
602
|
### **Configuration Management**
|
|
603
|
+
|
|
579
604
|
```bash
|
|
580
605
|
# Validate configuration
|
|
581
606
|
yama config validate
|
|
@@ -606,6 +631,7 @@ yama config show
|
|
|
606
631
|
Yama provides **100% backward compatibility** with your existing workflows:
|
|
607
632
|
|
|
608
633
|
### **From pr-police.js**
|
|
634
|
+
|
|
609
635
|
```bash
|
|
610
636
|
# Old way
|
|
611
637
|
node pr-police.js --workspace YOUR_WORKSPACE --repository repo --branch branch
|
|
@@ -618,8 +644,9 @@ yama police --workspace YOUR_WORKSPACE --repository repo --branch branch
|
|
|
618
644
|
```
|
|
619
645
|
|
|
620
646
|
### **From pr-describe.js / pr-scribe.js**
|
|
647
|
+
|
|
621
648
|
```bash
|
|
622
|
-
# Old way
|
|
649
|
+
# Old way
|
|
623
650
|
node pr-describe.js --workspace YOUR_WORKSPACE --repository repo --branch branch
|
|
624
651
|
|
|
625
652
|
# New way (identical functionality + optimizations)
|
|
@@ -630,6 +657,7 @@ yama scribe --workspace YOUR_WORKSPACE --repository repo --branch branch
|
|
|
630
657
|
```
|
|
631
658
|
|
|
632
659
|
### **New Unified Approach (Best Performance)**
|
|
660
|
+
|
|
633
661
|
```bash
|
|
634
662
|
# Best of both worlds + 90% performance improvement
|
|
635
663
|
yama process --workspace YOUR_WORKSPACE --repository repo --branch branch --operations all
|
|
@@ -668,8 +696,9 @@ yama process --workspace YOUR_WORKSPACE --repository repo --branch branch --oper
|
|
|
668
696
|
## ๐ **Why Yama?**
|
|
669
697
|
|
|
670
698
|
### **vs Individual Scripts**
|
|
699
|
+
|
|
671
700
|
1. **๐ 90% Performance Gain**: Unified context eliminates duplicate API calls
|
|
672
|
-
2. **๐ง Shared Intelligence**: AI analysis benefits from complete PR context
|
|
701
|
+
2. **๐ง Shared Intelligence**: AI analysis benefits from complete PR context
|
|
673
702
|
3. **๐พ Intelligent Caching**: Multi-layer caching with 80-90% hit rates
|
|
674
703
|
4. **๐ฆ Batch Processing**: Handles large PRs (50+ files) that would fail before
|
|
675
704
|
5. **๐ง Enterprise Features**: Health monitoring, configuration management, analytics
|
|
@@ -677,6 +706,7 @@ yama process --workspace YOUR_WORKSPACE --repository repo --branch branch --oper
|
|
|
677
706
|
7. **๐ Backward Compatible**: Existing workflows work unchanged
|
|
678
707
|
|
|
679
708
|
### **vs Other Tools**
|
|
709
|
+
|
|
680
710
|
1. **๐ฏ Purpose-Built**: Specifically designed for enterprise PR workflows
|
|
681
711
|
2. **๐ Security-First**: Built-in security analysis and hardcoded secret detection
|
|
682
712
|
3. **๐ค AI-Native**: Deep integration with multiple AI providers with fallbacks
|
|
@@ -698,6 +728,7 @@ yama process --workspace YOUR_WORKSPACE --repository repo --branch branch --oper
|
|
|
698
728
|
## ๐ **Performance Monitoring**
|
|
699
729
|
|
|
700
730
|
### **Built-in Metrics**
|
|
731
|
+
|
|
701
732
|
```typescript
|
|
702
733
|
const stats = guardian.getStats();
|
|
703
734
|
|
|
@@ -706,21 +737,22 @@ console.log({
|
|
|
706
737
|
totalOperations: stats.totalOperations,
|
|
707
738
|
avgProcessingTime: stats.avgProcessingTime,
|
|
708
739
|
successRate: stats.successRate,
|
|
709
|
-
apiCallsSaved: stats.apiCallsSaved
|
|
740
|
+
apiCallsSaved: stats.apiCallsSaved,
|
|
710
741
|
},
|
|
711
742
|
cache: {
|
|
712
743
|
hitRatio: stats.cache.hitRatio,
|
|
713
744
|
totalHits: stats.cache.hits,
|
|
714
|
-
keyCount: stats.cache.keys
|
|
745
|
+
keyCount: stats.cache.keys,
|
|
715
746
|
},
|
|
716
747
|
resources: {
|
|
717
748
|
memoryUsage: stats.memory,
|
|
718
|
-
activeConnections: stats.connections
|
|
719
|
-
}
|
|
749
|
+
activeConnections: stats.connections,
|
|
750
|
+
},
|
|
720
751
|
});
|
|
721
752
|
```
|
|
722
753
|
|
|
723
754
|
### **Performance Tracking**
|
|
755
|
+
|
|
724
756
|
```bash
|
|
725
757
|
# View performance metrics
|
|
726
758
|
yama status --detailed
|
|
@@ -737,7 +769,7 @@ yama status --detailed
|
|
|
737
769
|
## ๐ **Coming Soon (Future Phases)**
|
|
738
770
|
|
|
739
771
|
- **๐ Advanced Security Scanning**: Dependency vulnerability analysis, SAST integration
|
|
740
|
-
- **๐ Multi-Platform Support**: GitHub, GitLab, Azure DevOps integration
|
|
772
|
+
- **๐ Multi-Platform Support**: GitHub, GitLab, Azure DevOps integration
|
|
741
773
|
- **๐ Advanced Analytics**: Team productivity metrics, code quality trends
|
|
742
774
|
- **๐ค Custom AI Rules**: Train models on your codebase patterns
|
|
743
775
|
- **โก Parallel Processing**: Multi-PR batch processing for CI/CD integration
|
|
@@ -766,7 +798,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|
|
766
798
|
## ๐ **Support**
|
|
767
799
|
|
|
768
800
|
- **๐ Documentation**: [GitHub Wiki](https://github.com/juspay/yama/wiki)
|
|
769
|
-
- **๐ Issues**: [GitHub Issues](https://github.com/juspay/yama/issues)
|
|
801
|
+
- **๐ Issues**: [GitHub Issues](https://github.com/juspay/yama/issues)
|
|
770
802
|
- **๐ฌ Discussions**: [GitHub Discussions](https://github.com/juspay/yama/discussions)
|
|
771
803
|
- **๐ง Email**: opensource@juspay.in
|
|
772
804
|
|
|
@@ -780,7 +812,7 @@ BITBUCKET_USERNAME=your-username
|
|
|
780
812
|
BITBUCKET_TOKEN=your-personal-access-token
|
|
781
813
|
GOOGLE_AI_API_KEY=your-google-ai-api-key
|
|
782
814
|
|
|
783
|
-
# Optional
|
|
815
|
+
# Optional
|
|
784
816
|
BITBUCKET_BASE_URL=https://your-bitbucket-server.com
|
|
785
817
|
AI_PROVIDER=google-ai
|
|
786
818
|
AI_MODEL=gemini-2.5-pro
|
|
@@ -793,4 +825,4 @@ YAMA_DEBUG=false
|
|
|
793
825
|
|
|
794
826
|
**โ๏ธ Built with โค๏ธ by the Juspay team โข Powered by AI & Enterprise Security โข Code Quality Justice**
|
|
795
827
|
|
|
796
|
-
>
|
|
828
|
+
> _"In the realm of code, Yama stands as the eternal judge, ensuring only the worthy changes pass through to enlightenment."_
|