@juspay/yama 2.0.0 → 2.2.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/CHANGELOG.md +19 -0
- package/dist/cli/v2.cli.js +69 -0
- package/dist/v2/config/DefaultConfig.js +13 -17
- package/dist/v2/core/LearningOrchestrator.d.ts +65 -0
- package/dist/v2/core/LearningOrchestrator.js +499 -0
- package/dist/v2/core/MCPServerManager.js +12 -4
- 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/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 +7 -0
- package/dist/v2/prompts/PromptBuilder.js +37 -8
- package/dist/v2/prompts/ReviewSystemPrompt.d.ts +1 -1
- package/dist/v2/prompts/ReviewSystemPrompt.js +33 -24
- package/dist/v2/types/config.types.d.ts +22 -1
- package/dist/v2/types/mcp.types.d.ts +29 -8
- package/package.json +8 -4
- package/yama.config.example.yaml +58 -13
|
@@ -11,6 +11,7 @@ export interface YamaV2Config {
|
|
|
11
11
|
review: ReviewConfig;
|
|
12
12
|
descriptionEnhancement: DescriptionEnhancementConfig;
|
|
13
13
|
memoryBank: MemoryBankConfig;
|
|
14
|
+
knowledgeBase: KnowledgeBaseConfig;
|
|
14
15
|
projectStandards?: ProjectStandardsConfig;
|
|
15
16
|
monitoring: MonitoringConfig;
|
|
16
17
|
performance: PerformanceConfig;
|
|
@@ -48,15 +49,21 @@ export interface RedisConfig {
|
|
|
48
49
|
ttl?: number;
|
|
49
50
|
}
|
|
50
51
|
export interface MCPServersConfig {
|
|
52
|
+
bitbucket?: {
|
|
53
|
+
/** List of tool names to block from Bitbucket MCP server */
|
|
54
|
+
blockedTools?: string[];
|
|
55
|
+
};
|
|
51
56
|
jira: {
|
|
52
57
|
enabled: boolean;
|
|
58
|
+
/** List of tool names to block from Jira MCP server */
|
|
59
|
+
blockedTools?: string[];
|
|
53
60
|
};
|
|
54
61
|
}
|
|
55
62
|
export interface ReviewConfig {
|
|
56
63
|
enabled: boolean;
|
|
57
64
|
workflowInstructions: string;
|
|
58
65
|
focusAreas: FocusArea[];
|
|
59
|
-
blockingCriteria
|
|
66
|
+
blockingCriteria?: BlockingCriteria[];
|
|
60
67
|
excludePatterns: string[];
|
|
61
68
|
contextLines: number;
|
|
62
69
|
maxFilesPerReview: number;
|
|
@@ -90,6 +97,20 @@ export interface MemoryBankConfig {
|
|
|
90
97
|
fallbackPaths: string[];
|
|
91
98
|
standardFiles?: string[];
|
|
92
99
|
}
|
|
100
|
+
export interface KnowledgeBaseConfig {
|
|
101
|
+
/** Enable knowledge base feature */
|
|
102
|
+
enabled: boolean;
|
|
103
|
+
/** Path to knowledge base file (relative to project root) */
|
|
104
|
+
path: string;
|
|
105
|
+
/** Patterns to identify AI comment authors (case-insensitive) */
|
|
106
|
+
aiAuthorPatterns: string[];
|
|
107
|
+
/** Number of learnings before auto-summarization triggers */
|
|
108
|
+
maxEntriesBeforeSummarization: number;
|
|
109
|
+
/** Number of entries to retain after summarization */
|
|
110
|
+
summaryRetentionCount: number;
|
|
111
|
+
/** Auto-commit knowledge base changes (default for --commit flag) */
|
|
112
|
+
autoCommit: boolean;
|
|
113
|
+
}
|
|
93
114
|
export interface ProjectStandardsConfig {
|
|
94
115
|
customPromptsPath: string;
|
|
95
116
|
additionalFocusAreas: FocusArea[];
|
|
@@ -77,21 +77,42 @@ export interface FileChange {
|
|
|
77
77
|
file?: string;
|
|
78
78
|
type: "ADD" | "MODIFY" | "DELETE" | "RENAME";
|
|
79
79
|
}
|
|
80
|
+
export interface DiffLine {
|
|
81
|
+
source_line: number | null;
|
|
82
|
+
destination_line: number | null;
|
|
83
|
+
type: "ADDED" | "REMOVED" | "CONTEXT";
|
|
84
|
+
content: string;
|
|
85
|
+
}
|
|
86
|
+
export interface DiffHunk {
|
|
87
|
+
source_start: number;
|
|
88
|
+
source_length: number;
|
|
89
|
+
destination_start: number;
|
|
90
|
+
destination_length: number;
|
|
91
|
+
lines: DiffLine[];
|
|
92
|
+
}
|
|
93
|
+
export interface DiffFile {
|
|
94
|
+
file_path: string;
|
|
95
|
+
old_path?: string;
|
|
96
|
+
status: "added" | "modified" | "deleted" | "renamed";
|
|
97
|
+
hunks: DiffHunk[];
|
|
98
|
+
}
|
|
80
99
|
export interface GetPullRequestDiffResponse {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
100
|
+
files: DiffFile[];
|
|
101
|
+
stats?: {
|
|
102
|
+
additions: number;
|
|
103
|
+
deletions: number;
|
|
104
|
+
files_changed: number;
|
|
105
|
+
};
|
|
85
106
|
}
|
|
86
107
|
export interface AddCommentRequest {
|
|
87
108
|
workspace: string;
|
|
88
109
|
repository: string;
|
|
89
110
|
pull_request_id: number;
|
|
90
111
|
comment_text: string;
|
|
91
|
-
file_path
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
112
|
+
file_path: string;
|
|
113
|
+
line_number: number;
|
|
114
|
+
line_type: "ADDED" | "REMOVED" | "CONTEXT";
|
|
115
|
+
suggestion?: string;
|
|
95
116
|
parent_comment_id?: number;
|
|
96
117
|
}
|
|
97
118
|
export interface AddCommentResponse {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/yama",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Enterprise-grade Pull Request automation toolkit with AI-powered code review and description enhancement",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pr",
|
|
@@ -83,8 +83,9 @@
|
|
|
83
83
|
"check:all": "npm run lint && npm run format --check && npm run validate && npm run validate:commit"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@juspay/neurolink": "^8.1
|
|
87
|
-
"
|
|
86
|
+
"@juspay/neurolink": "^8.34.1",
|
|
87
|
+
"langfuse": "^3.35.0",
|
|
88
|
+
"@nexus2520/bitbucket-mcp-server": "^1.4.0",
|
|
88
89
|
"@nexus2520/jira-mcp-server": "^1.0.1",
|
|
89
90
|
"chalk": "^4.1.2",
|
|
90
91
|
"commander": "^11.0.0",
|
|
@@ -150,7 +151,10 @@
|
|
|
150
151
|
"pnpm": {
|
|
151
152
|
"onlyBuiltDependencies": [
|
|
152
153
|
"esbuild"
|
|
153
|
-
]
|
|
154
|
+
],
|
|
155
|
+
"overrides": {
|
|
156
|
+
"@semantic-release/npm": "^13.1.2"
|
|
157
|
+
}
|
|
154
158
|
},
|
|
155
159
|
"lint-staged": {
|
|
156
160
|
"*.{ts,tsx,js,jsx}": [
|
package/yama.config.example.yaml
CHANGED
|
@@ -39,9 +39,25 @@ ai:
|
|
|
39
39
|
# ============================================================================
|
|
40
40
|
# Bitbucket MCP is always enabled (hardcoded)
|
|
41
41
|
# Jira MCP can be enabled/disabled here
|
|
42
|
+
# Use blockedTools to prevent AI from using specific MCP tools
|
|
42
43
|
mcpServers:
|
|
44
|
+
bitbucket:
|
|
45
|
+
# Optional: Block specific Bitbucket tools from AI access
|
|
46
|
+
# This prevents the AI from performing certain actions
|
|
47
|
+
blockedTools: []
|
|
48
|
+
# Example blocked tools (uncomment to use):
|
|
49
|
+
# - merge_pull_request # Prevent AI from merging PRs
|
|
50
|
+
# - delete_branch # Prevent AI from deleting branches
|
|
51
|
+
# - approve_pull_request # Prevent AI from auto-approving PRs
|
|
52
|
+
|
|
43
53
|
jira:
|
|
44
54
|
enabled: true # Set to false to disable Jira integration
|
|
55
|
+
# Optional: Block specific Jira tools from AI access
|
|
56
|
+
blockedTools: []
|
|
57
|
+
# Example blocked tools (uncomment to use):
|
|
58
|
+
# - jira_create_issue # Prevent AI from creating Jira issues
|
|
59
|
+
# - jira_delete_issue # Prevent AI from deleting issues
|
|
60
|
+
# - jira_update_issue # Prevent AI from modifying issues
|
|
45
61
|
|
|
46
62
|
# ============================================================================
|
|
47
63
|
# Review Configuration
|
|
@@ -89,19 +105,22 @@ review:
|
|
|
89
105
|
- Poor naming conventions
|
|
90
106
|
- Missing edge case handling
|
|
91
107
|
|
|
92
|
-
# Blocking criteria (AI uses these to decide whether to block PR)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
# Blocking criteria (OPTIONAL - AI uses these to decide whether to block PR)
|
|
109
|
+
# If not provided or empty, AI will review and comment but NOT auto-block/approve PRs
|
|
110
|
+
# Uncomment and customize the examples below to enable auto-blocking:
|
|
111
|
+
blockingCriteria: []
|
|
112
|
+
# blockingCriteria:
|
|
113
|
+
# - condition: "ANY CRITICAL severity issue"
|
|
114
|
+
# action: "BLOCK"
|
|
115
|
+
# reason: "Security or data loss risk"
|
|
116
|
+
#
|
|
117
|
+
# - condition: "3 or more MAJOR severity issues"
|
|
118
|
+
# action: "BLOCK"
|
|
119
|
+
# reason: "Too many significant bugs/performance issues"
|
|
120
|
+
#
|
|
121
|
+
# - condition: "Jira requirement coverage < 70%"
|
|
122
|
+
# action: "BLOCK"
|
|
123
|
+
# reason: "Incomplete implementation of requirements"
|
|
105
124
|
|
|
106
125
|
# Files to exclude from analysis
|
|
107
126
|
excludePatterns:
|
|
@@ -183,6 +202,32 @@ memoryBank:
|
|
|
183
202
|
- "coding-standards.md"
|
|
184
203
|
- "security-guidelines.md"
|
|
185
204
|
|
|
205
|
+
# ============================================================================
|
|
206
|
+
# Knowledge Base - Reinforcement Learning from PR Feedback
|
|
207
|
+
# ============================================================================
|
|
208
|
+
# Yama learns from developer feedback on AI comments across merged PRs.
|
|
209
|
+
# Use 'yama learn -w <workspace> -r <repo> -p <pr-id>' to extract learnings.
|
|
210
|
+
knowledgeBase:
|
|
211
|
+
enabled: true
|
|
212
|
+
|
|
213
|
+
# Path to knowledge base file (relative to repo root)
|
|
214
|
+
path: ".yama/knowledge-base.md"
|
|
215
|
+
|
|
216
|
+
# Patterns to identify AI-generated comments (author name matching)
|
|
217
|
+
aiAuthorPatterns:
|
|
218
|
+
- "Yama"
|
|
219
|
+
- "yama-bot"
|
|
220
|
+
- "yama-review"
|
|
221
|
+
|
|
222
|
+
# Automatically summarize knowledge base when entry count exceeds this
|
|
223
|
+
maxEntriesBeforeSummarization: 50
|
|
224
|
+
|
|
225
|
+
# How many consolidated entries to keep after summarization
|
|
226
|
+
summaryRetentionCount: 20
|
|
227
|
+
|
|
228
|
+
# Automatically commit knowledge base changes (with --commit flag)
|
|
229
|
+
autoCommit: false
|
|
230
|
+
|
|
186
231
|
# ============================================================================
|
|
187
232
|
# Project-Specific Standards (Override in your repository)
|
|
188
233
|
# ============================================================================
|