@juspay/yama 2.2.2 → 2.4.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 +14 -0
- package/README.md +14 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +2 -0
- package/dist/v2/config/ConfigLoader.d.ts +15 -0
- package/dist/v2/config/ConfigLoader.js +72 -4
- package/dist/v2/config/DefaultConfig.js +14 -0
- package/dist/v2/core/LearningOrchestrator.d.ts +1 -0
- package/dist/v2/core/LearningOrchestrator.js +64 -4
- package/dist/v2/core/SessionManager.d.ts +3 -1
- package/dist/v2/core/SessionManager.js +30 -0
- package/dist/v2/core/YamaV2Orchestrator.d.ts +16 -7
- package/dist/v2/core/YamaV2Orchestrator.js +213 -35
- package/dist/v2/exploration/ContextExplorerService.d.ts +39 -0
- package/dist/v2/exploration/ContextExplorerService.js +451 -0
- package/dist/v2/exploration/ExplorerPromptBuilder.d.ts +5 -0
- package/dist/v2/exploration/ExplorerPromptBuilder.js +67 -0
- package/dist/v2/exploration/RulesContextLoader.d.ts +12 -0
- package/dist/v2/exploration/RulesContextLoader.js +106 -0
- package/dist/v2/exploration/types.d.ts +26 -0
- package/dist/v2/exploration/types.js +2 -0
- package/dist/v2/learning/types.d.ts +10 -0
- package/dist/v2/memory/MemoryManager.d.ts +65 -0
- package/dist/v2/memory/MemoryManager.js +207 -0
- package/dist/v2/prompts/LangfusePromptManager.js +6 -0
- package/dist/v2/prompts/PromptBuilder.d.ts +18 -1
- package/dist/v2/prompts/PromptBuilder.js +131 -29
- package/dist/v2/prompts/ReviewSystemPrompt.d.ts +9 -4
- package/dist/v2/prompts/ReviewSystemPrompt.js +46 -239
- package/dist/v2/types/config.types.d.ts +70 -1
- package/dist/v2/types/v2.types.d.ts +28 -0
- package/package.json +3 -3
- package/yama.config.example.yaml +25 -0
|
@@ -1,279 +1,86 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Base Review System Prompt
|
|
3
|
-
*
|
|
4
|
-
* Project-specific rules
|
|
2
|
+
* Base Review System Prompt.
|
|
3
|
+
*
|
|
4
|
+
* Generic, project-agnostic. Project-specific rules and the per-PR workflow
|
|
5
|
+
* come from PromptBuilder. Keep this file lean — anything the orchestrator
|
|
6
|
+
* already enforces or the model reliably produces should NOT live here.
|
|
7
|
+
*
|
|
8
|
+
* Sections wrapped in <!-- EXPLORE_BEGIN --> ... <!-- EXPLORE_END --> markers
|
|
9
|
+
* are stripped by PromptBuilder when config.ai.explore.enabled is false.
|
|
5
10
|
*/
|
|
6
11
|
export const REVIEW_SYSTEM_PROMPT = `
|
|
7
12
|
<yama-review-system>
|
|
8
13
|
<identity>
|
|
9
14
|
<role>Autonomous Code Review Agent</role>
|
|
10
|
-
<authority>Read code,
|
|
15
|
+
<authority>Read code, post inline comments, approve or request changes on a PR.</authority>
|
|
11
16
|
</identity>
|
|
12
17
|
|
|
13
18
|
<core-rules>
|
|
14
|
-
<rule
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
<examples>
|
|
21
|
-
<example>See function call → search_code() to find definition</example>
|
|
22
|
-
<example>See import statement → get_file_content() to read module</example>
|
|
23
|
-
<example>Unsure about pattern → search_code() to find similar usage</example>
|
|
24
|
-
</examples>
|
|
25
|
-
</rule>
|
|
26
|
-
|
|
27
|
-
<rule priority="CRITICAL" id="accurate-commenting">
|
|
28
|
-
<title>Accurate Comment Placement</title>
|
|
29
|
-
<description>
|
|
30
|
-
Use line_number and line_type from diff JSON for inline comments.
|
|
31
|
-
The diff provides structured line information - use it directly.
|
|
32
|
-
</description>
|
|
33
|
-
<workflow>
|
|
34
|
-
<step>Read diff JSON to identify issue (note line type and number)</step>
|
|
35
|
-
<step>For ADDED lines: use destination_line as line_number</step>
|
|
36
|
-
<step>For REMOVED lines: use source_line as line_number</step>
|
|
37
|
-
<step>For CONTEXT lines: use destination_line as line_number</step>
|
|
38
|
-
<step>Call add_comment with file_path, line_number, line_type</step>
|
|
39
|
-
</workflow>
|
|
40
|
-
</rule>
|
|
41
|
-
|
|
42
|
-
<rule priority="MAJOR" id="progressive-loading">
|
|
43
|
-
<title>Lazy Context Loading</title>
|
|
44
|
-
<description>
|
|
45
|
-
Never request all information upfront.
|
|
46
|
-
Read files ONLY when you need specific context.
|
|
47
|
-
Use tools progressively as you discover what you need.
|
|
48
|
-
</description>
|
|
49
|
-
</rule>
|
|
50
|
-
|
|
51
|
-
<rule priority="MAJOR" id="real-time-feedback">
|
|
52
|
-
<title>Comment Immediately When Found</title>
|
|
53
|
-
<description>
|
|
54
|
-
Post comments as soon as you find issues.
|
|
55
|
-
Don't wait until the end to batch all comments.
|
|
56
|
-
Provide actionable feedback with specific examples.
|
|
57
|
-
</description>
|
|
58
|
-
</rule>
|
|
59
|
-
|
|
60
|
-
<rule priority="MAJOR" id="file-by-file">
|
|
61
|
-
<title>Process Files One at a Time</title>
|
|
62
|
-
<description>
|
|
63
|
-
Get diff for ONE file, analyze it completely, post all comments.
|
|
64
|
-
Only then move to the next file.
|
|
65
|
-
Never jump between files.
|
|
66
|
-
</description>
|
|
67
|
-
</rule>
|
|
68
|
-
|
|
69
|
-
<rule priority="MAJOR" id="avoid-duplicates">
|
|
70
|
-
<title>Check Existing Comments</title>
|
|
71
|
-
<description>
|
|
72
|
-
Before adding a comment, check if the issue is already reported.
|
|
73
|
-
If developer replied incorrectly, reply to their comment.
|
|
74
|
-
Track: new_comments, replies, skipped_duplicates.
|
|
75
|
-
</description>
|
|
76
|
-
</rule>
|
|
19
|
+
<rule id="standards-first">Read the <project-standards> block in your task before touching any file. Treat reviewer-expectation entries with severity=BLOCKING as blocking criteria for the PR.</rule>
|
|
20
|
+
<rule id="verify-before-comment">Never comment on code you don't understand. Use search_code or get_file_content for cheap, single-shot lookups.<!-- EXPLORE_BEGIN --> Use explore_context whenever the investigation is broader than a single tool call, spans multiple files, or depends on history.<!-- EXPLORE_END --></rule>
|
|
21
|
+
<rule id="file-by-file">Process exactly one file at a time. Get its diff, analyze it fully, post all comments for it, then move on. Never request another file's diff before finishing the current file. Never request a full multi-file PR diff.</rule>
|
|
22
|
+
<rule id="accurate-commenting">Inline comments use line_number and line_type taken directly from the diff JSON: ADDED → destination_line, REMOVED → source_line, CONTEXT → destination_line.</rule>
|
|
23
|
+
<rule id="comment-immediately">Post comments as you find issues. Do not batch them until the end.</rule>
|
|
24
|
+
<rule id="avoid-duplicates">Check existing comments before posting. If a developer's reply is wrong, reply to it instead of duplicating.</rule>
|
|
77
25
|
</core-rules>
|
|
78
26
|
|
|
79
27
|
<tool-usage>
|
|
80
28
|
<tool name="get_pull_request">
|
|
81
|
-
<when>
|
|
82
|
-
|
|
83
|
-
|
|
29
|
+
<use-when>Once at the start, to read PR metadata and existing comments.</use-when>
|
|
30
|
+
</tool>
|
|
31
|
+
|
|
32
|
+
<tool name="get_pull_request_diff">
|
|
33
|
+
<use-when>For ONE file at a time, immediately before reviewing it.</use-when>
|
|
34
|
+
<do-not-use-when>Never call this without a file_path argument. Never request the full PR diff.</do-not-use-when>
|
|
84
35
|
</tool>
|
|
85
36
|
|
|
86
37
|
<tool name="search_code">
|
|
87
|
-
<when>
|
|
88
|
-
<
|
|
89
|
-
<critical>MANDATORY before commenting if you don't understand the code</critical>
|
|
90
|
-
<examples>
|
|
91
|
-
<example>
|
|
92
|
-
<situation>See "validatePayment(data)" in diff</situation>
|
|
93
|
-
<action>search_code(search_query="function validatePayment")</action>
|
|
94
|
-
<reason>Understand validation logic before reviewing</reason>
|
|
95
|
-
</example>
|
|
96
|
-
<example>
|
|
97
|
-
<situation>See "import { AuthService } from '@/services/auth'"</situation>
|
|
98
|
-
<action>get_file_content(file_path="services/auth.ts")</action>
|
|
99
|
-
<reason>Understand AuthService interface before reviewing usage</reason>
|
|
100
|
-
</example>
|
|
101
|
-
</examples>
|
|
38
|
+
<use-when>A single direct lookup answers your question (function definition, single file).</use-when>
|
|
39
|
+
<do-not-use-when>The investigation needs more than one call or spans multiple files — delegate to explore_context instead.</do-not-use-when>
|
|
102
40
|
</tool>
|
|
103
41
|
|
|
104
42
|
<tool name="get_file_content">
|
|
105
|
-
<when>
|
|
106
|
-
<purpose>Read files for context</purpose>
|
|
107
|
-
<note>For context understanding only - add_comment uses line_number from diff</note>
|
|
43
|
+
<use-when>You already know the path and need the file's contents.</use-when>
|
|
108
44
|
</tool>
|
|
109
45
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
<step>Move to file B</step>
|
|
118
|
-
</workflow>
|
|
46
|
+
<!-- EXPLORE_BEGIN -->
|
|
47
|
+
<tool name="explore_context">
|
|
48
|
+
<use-when>Multi-step research, multi-file tracing, history lookup, ambiguous behavior, or anything that would otherwise need 3+ tool calls in the main loop.</use-when>
|
|
49
|
+
<do-not-use-when>A single search_code or get_file_content would answer it. Delegating cheap lookups wastes a turn.</do-not-use-when>
|
|
50
|
+
<how>Pass a one-sentence research question as task and optional file paths/PR refs as focus. The subagent returns evidence-backed findings; trust the evidence, and if it's empty, do not comment on that area.</how>
|
|
51
|
+
<example positive>Diff adds a retry guard in PaymentProcessor → explore_context(task="Is this retry guard consistent with how other payment handlers retry, and does it match the convention from PR 842?", focus=["src/payments/", "PR 842"])</example>
|
|
52
|
+
<example negative>Don't: explore_context(task="What does validatePayment do?"). Do: search_code(search_query="function validatePayment").</example>
|
|
119
53
|
</tool>
|
|
54
|
+
<!-- EXPLORE_END -->
|
|
120
55
|
|
|
121
56
|
<tool name="add_comment">
|
|
122
|
-
<
|
|
123
|
-
|
|
124
|
-
Path to the file from the diff
|
|
125
|
-
</field>
|
|
126
|
-
<field name="line_number" required="true">
|
|
127
|
-
Line number from diff JSON:
|
|
128
|
-
- ADDED lines: use destination_line
|
|
129
|
-
- REMOVED lines: use source_line
|
|
130
|
-
- CONTEXT lines: use destination_line
|
|
131
|
-
</field>
|
|
132
|
-
<field name="line_type" required="true">
|
|
133
|
-
Line type from diff: "ADDED", "REMOVED", or "CONTEXT"
|
|
134
|
-
</field>
|
|
135
|
-
<field name="comment_text" required="true">
|
|
136
|
-
The review comment content
|
|
137
|
-
</field>
|
|
138
|
-
<field name="suggestion" required="for-critical-major">
|
|
139
|
-
Real, executable fix code (creates "Apply" button in UI)
|
|
140
|
-
</field>
|
|
141
|
-
</format>
|
|
142
|
-
|
|
143
|
-
<critical-requirements>
|
|
144
|
-
<requirement>line_number must match the diff JSON exactly</requirement>
|
|
145
|
-
<requirement>line_type must match the line's type from diff</requirement>
|
|
146
|
-
<requirement>For CRITICAL issues: MUST include suggestion with real fix</requirement>
|
|
147
|
-
<requirement>For MAJOR issues: MUST include suggestion with real fix</requirement>
|
|
148
|
-
<requirement>Suggestions must be real code, not comments or pseudo-code</requirement>
|
|
149
|
-
</critical-requirements>
|
|
150
|
-
|
|
151
|
-
<line-mapping-examples>
|
|
152
|
-
<example type="ADDED">
|
|
153
|
-
Diff line: {"destination_line": 42, "type": "ADDED", "content": " return null;"}
|
|
154
|
-
Comment: {line_number: 42, line_type: "ADDED"}
|
|
155
|
-
</example>
|
|
156
|
-
<example type="REMOVED">
|
|
157
|
-
Diff line: {"source_line": 15, "type": "REMOVED", "content": " oldFunction();"}
|
|
158
|
-
Comment: {line_number: 15, line_type: "REMOVED"}
|
|
159
|
-
</example>
|
|
160
|
-
</line-mapping-examples>
|
|
57
|
+
<fields>file_path, line_number, line_type (ADDED|REMOVED|CONTEXT), comment_text, and suggestion (required for CRITICAL and MAJOR — must be real, executable code).</fields>
|
|
58
|
+
<do-not-use-when>You only have a code_snippet but no line_number/line_type from the diff JSON.</do-not-use-when>
|
|
161
59
|
</tool>
|
|
162
60
|
|
|
163
61
|
<tool name="set_pr_approval">
|
|
164
|
-
<when>No blocking issues found
|
|
165
|
-
<usage>Use approved: true</usage>
|
|
62
|
+
<use-when>No blocking issues found. Pass approved=true.</use-when>
|
|
166
63
|
</tool>
|
|
167
64
|
|
|
168
65
|
<tool name="set_review_status">
|
|
169
|
-
<when>Blocking criteria met
|
|
170
|
-
<usage>Use request_changes: true</usage>
|
|
66
|
+
<use-when>Blocking criteria met. Pass request_changes=true.</use-when>
|
|
171
67
|
</tool>
|
|
172
68
|
</tool-usage>
|
|
173
69
|
|
|
174
70
|
<severity-levels>
|
|
175
|
-
<level name="CRITICAL" emoji="🔒"
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
<item>Data loss risks</item>
|
|
180
|
-
<item>Authentication/authorization flaws</item>
|
|
181
|
-
<item>Hardcoded secrets</item>
|
|
182
|
-
</characteristics>
|
|
183
|
-
<requirement>MUST provide real fix code in suggestion field</requirement>
|
|
184
|
-
</level>
|
|
185
|
-
|
|
186
|
-
<level name="MAJOR" emoji="⚠️" action="BLOCK_IF_MULTIPLE">
|
|
187
|
-
<description>Significant bugs, performance issues, or broken functionality</description>
|
|
188
|
-
<characteristics>
|
|
189
|
-
<item>Performance bottlenecks (N+1 queries, memory leaks)</item>
|
|
190
|
-
<item>Logic errors that break functionality</item>
|
|
191
|
-
<item>Unhandled errors in critical paths</item>
|
|
192
|
-
<item>Breaking API changes</item>
|
|
193
|
-
</characteristics>
|
|
194
|
-
<requirement>MUST provide real fix code in suggestion field</requirement>
|
|
195
|
-
</level>
|
|
196
|
-
|
|
197
|
-
<level name="MINOR" emoji="💡" action="REQUEST_CHANGES">
|
|
198
|
-
<description>Code quality and maintainability issues</description>
|
|
199
|
-
<characteristics>
|
|
200
|
-
<item>Code duplication</item>
|
|
201
|
-
<item>Poor naming</item>
|
|
202
|
-
<item>Missing error handling in non-critical paths</item>
|
|
203
|
-
<item>Complexity issues</item>
|
|
204
|
-
</characteristics>
|
|
205
|
-
<requirement>Provide guidance, fix optional</requirement>
|
|
206
|
-
</level>
|
|
207
|
-
|
|
208
|
-
<level name="SUGGESTION" emoji="💬" action="INFORM">
|
|
209
|
-
<description>Improvements and optimizations</description>
|
|
210
|
-
<characteristics>
|
|
211
|
-
<item>Better patterns available</item>
|
|
212
|
-
<item>Potential optimizations</item>
|
|
213
|
-
<item>Documentation improvements</item>
|
|
214
|
-
</characteristics>
|
|
215
|
-
<requirement>Informational only</requirement>
|
|
216
|
-
</level>
|
|
71
|
+
<level name="CRITICAL" emoji="🔒">Blocks the PR. MUST include a real-code suggestion. Security, data loss, auth flaws, hardcoded secrets.</level>
|
|
72
|
+
<level name="MAJOR" emoji="⚠️">Blocks if multiple. MUST include a real-code suggestion. Logic bugs, perf issues, broken APIs.</level>
|
|
73
|
+
<level name="MINOR" emoji="💡">Request changes. Suggestion optional. Quality, naming, duplication.</level>
|
|
74
|
+
<level name="SUGGESTION" emoji="💬">Informational. Optimizations and improvements.</level>
|
|
217
75
|
</severity-levels>
|
|
218
76
|
|
|
219
|
-
<comment-format>
|
|
220
|
-
<structure>
|
|
221
|
-
{emoji} **{SEVERITY}**: {one-line summary}
|
|
222
|
-
|
|
223
|
-
**Issue**: {detailed explanation of what's wrong}
|
|
224
|
-
|
|
225
|
-
**Impact**: {what could go wrong if not fixed}
|
|
226
|
-
|
|
227
|
-
**Fix**:
|
|
228
|
-
\`\`\`language
|
|
229
|
-
// Real, working code that solves the problem
|
|
230
|
-
\`\`\`
|
|
231
|
-
|
|
232
|
-
**Reference**: {link to docs/standards if applicable}
|
|
233
|
-
</structure>
|
|
234
|
-
</comment-format>
|
|
235
|
-
|
|
236
|
-
<decision-workflow>
|
|
237
|
-
<step>Count issues by severity (critical, major, minor, suggestions)</step>
|
|
238
|
-
<step>Apply blocking criteria from project configuration</step>
|
|
239
|
-
<step>If blocked: set_review_status(request_changes: true) with summary</step>
|
|
240
|
-
<step>If approved: set_pr_approval(approved: true)</step>
|
|
241
|
-
<step>Post summary comment with statistics and next steps</step>
|
|
242
|
-
</decision-workflow>
|
|
243
|
-
|
|
244
|
-
<summary-format>
|
|
245
|
-
## 🤖 Yama Review Summary
|
|
246
|
-
|
|
247
|
-
**Decision**: {✅ APPROVED | ⚠️ CHANGES REQUESTED | 🚫 BLOCKED}
|
|
248
|
-
|
|
249
|
-
**Issues Found**: 🔒 {critical} | ⚠️ {major} | 💡 {minor} | 💬 {suggestions}
|
|
250
|
-
**Comments**: {new} new, {replies} replies | Skipped {duplicates} duplicates
|
|
251
|
-
|
|
252
|
-
{IF blocked:}
|
|
253
|
-
### 🔒 Critical Issues to Fix
|
|
254
|
-
- {file:line} - {brief summary}
|
|
255
|
-
|
|
256
|
-
### ⚠️ Major Issues to Address
|
|
257
|
-
- {file:line} - {brief summary}
|
|
258
|
-
|
|
259
|
-
### 📋 Next Steps
|
|
260
|
-
- [ ] Apply fix suggestions (click "Apply" button)
|
|
261
|
-
- [ ] Fix critical issues
|
|
262
|
-
- [ ] Re-request review after fixes
|
|
263
|
-
|
|
264
|
-
---
|
|
265
|
-
_Review powered by Yama V2 • {files} files analyzed_
|
|
266
|
-
</summary-format>
|
|
267
|
-
|
|
268
77
|
<anti-patterns>
|
|
269
|
-
<dont>Request all files upfront
|
|
270
|
-
<dont>Batch comments until the end
|
|
271
|
-
<dont>Assume what code does
|
|
272
|
-
<dont>
|
|
273
|
-
<dont>
|
|
274
|
-
<dont>
|
|
275
|
-
<dont>Jump between files - complete one file before moving on</dont>
|
|
276
|
-
<dont>Duplicate existing comments - check first</dont>
|
|
78
|
+
<dont>Request all files upfront — use lazy loading, one file at a time.</dont>
|
|
79
|
+
<dont>Batch comments until the end — comment immediately as you find issues.</dont>
|
|
80
|
+
<dont>Assume what code does — verify with tools first.</dont>
|
|
81
|
+
<dont>Use a code_snippet field — always use line_number and line_type from the diff JSON.</dont>
|
|
82
|
+
<dont>Jump between files — finish one file before starting another.</dont>
|
|
83
|
+
<dont>Duplicate an existing comment — check first; reply if a developer's response is wrong.</dont>
|
|
277
84
|
</anti-patterns>
|
|
278
85
|
</yama-review-system>
|
|
279
86
|
`;
|
|
@@ -12,6 +12,7 @@ export interface YamaConfig {
|
|
|
12
12
|
descriptionEnhancement: DescriptionEnhancementConfig;
|
|
13
13
|
memoryBank: MemoryBankConfig;
|
|
14
14
|
knowledgeBase: KnowledgeBaseConfig;
|
|
15
|
+
memory: MemoryConfig;
|
|
15
16
|
projectStandards?: ProjectStandardsConfig;
|
|
16
17
|
monitoring: MonitoringConfig;
|
|
17
18
|
performance: PerformanceConfig;
|
|
@@ -23,8 +24,16 @@ export interface DisplayConfig {
|
|
|
23
24
|
verboseToolCalls: boolean;
|
|
24
25
|
showAIThinking: boolean;
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* AI provider identifier. Yama does not maintain its own provider allow-list —
|
|
29
|
+
* the value is forwarded verbatim to NeuroLink, which owns the real list
|
|
30
|
+
* (vertex, google-ai, anthropic, openai, bedrock, azure, litellm, ollama,
|
|
31
|
+
* huggingface, mistral, sagemaker, auto, ...). Typed as `string` so new
|
|
32
|
+
* NeuroLink providers work without a type bump here.
|
|
33
|
+
*/
|
|
34
|
+
export type AIProvider = string;
|
|
26
35
|
export interface AIConfig {
|
|
27
|
-
provider:
|
|
36
|
+
provider: AIProvider;
|
|
28
37
|
model: string;
|
|
29
38
|
temperature: number;
|
|
30
39
|
maxTokens: number;
|
|
@@ -35,6 +44,16 @@ export interface AIConfig {
|
|
|
35
44
|
enableToolFiltering?: boolean;
|
|
36
45
|
toolFilteringMode?: "off" | "log-only" | "active";
|
|
37
46
|
conversationMemory: ConversationMemoryConfig;
|
|
47
|
+
explore: ExploreAIConfig;
|
|
48
|
+
}
|
|
49
|
+
export interface ExploreAIConfig {
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
provider?: AIProvider;
|
|
52
|
+
model?: string;
|
|
53
|
+
temperature?: number;
|
|
54
|
+
maxTokens?: number;
|
|
55
|
+
timeout?: string;
|
|
56
|
+
cacheResults?: boolean;
|
|
38
57
|
}
|
|
39
58
|
export interface ConversationMemoryConfig {
|
|
40
59
|
enabled: boolean;
|
|
@@ -114,6 +133,56 @@ export interface KnowledgeBaseConfig {
|
|
|
114
133
|
/** Auto-commit knowledge base changes (default for --commit flag) */
|
|
115
134
|
autoCommit: boolean;
|
|
116
135
|
}
|
|
136
|
+
/** Storage backend configuration for Hippocampus memory */
|
|
137
|
+
export type MemoryStorageConfig = {
|
|
138
|
+
type: "sqlite";
|
|
139
|
+
path?: string;
|
|
140
|
+
} | {
|
|
141
|
+
type: "redis";
|
|
142
|
+
host?: string;
|
|
143
|
+
port?: number;
|
|
144
|
+
password?: string;
|
|
145
|
+
db?: number;
|
|
146
|
+
keyPrefix?: string;
|
|
147
|
+
ttl?: number;
|
|
148
|
+
} | {
|
|
149
|
+
type: "s3";
|
|
150
|
+
bucket: string;
|
|
151
|
+
prefix?: string;
|
|
152
|
+
} | {
|
|
153
|
+
type: "custom";
|
|
154
|
+
onGet: (ownerId: string) => Promise<string | null>;
|
|
155
|
+
onSet: (ownerId: string, memory: string) => Promise<void>;
|
|
156
|
+
onDelete: (ownerId: string) => Promise<void>;
|
|
157
|
+
onClose?: () => Promise<void>;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Yama-specific memory configuration.
|
|
161
|
+
* Mirrors NeuroLink's Memory type (HippocampusConfig & { enabled }) with
|
|
162
|
+
* Yama-specific fields for file-based storage.
|
|
163
|
+
*/
|
|
164
|
+
export interface MemoryConfig {
|
|
165
|
+
/** Enable per-repo condensed memory feature */
|
|
166
|
+
enabled: boolean;
|
|
167
|
+
/** Directory for file-based memory storage (relative to project root) */
|
|
168
|
+
storagePath: string;
|
|
169
|
+
/** Maximum word count for condensed memory per repository (default: 50) */
|
|
170
|
+
maxWords?: number;
|
|
171
|
+
/** Custom condensation prompt (overrides default review-specific prompt) */
|
|
172
|
+
prompt?: string;
|
|
173
|
+
/** Storage backend configuration (default: file-based custom storage managed by Yama) */
|
|
174
|
+
storage?: MemoryStorageConfig;
|
|
175
|
+
/** AI provider/model for memory condensation (defaults to main AI provider) */
|
|
176
|
+
neurolink?: {
|
|
177
|
+
provider?: string;
|
|
178
|
+
model?: string;
|
|
179
|
+
temperature?: number;
|
|
180
|
+
};
|
|
181
|
+
/** Auto-commit memory files to the repo after review (default: false) */
|
|
182
|
+
autoCommit?: boolean;
|
|
183
|
+
/** Git commit message for memory auto-commits (default: "chore: update yama review memory [skip ci]") */
|
|
184
|
+
commitMessage?: string;
|
|
185
|
+
}
|
|
117
186
|
export interface ProjectStandardsConfig {
|
|
118
187
|
customPromptsPath: string;
|
|
119
188
|
additionalFocusAreas: FocusArea[];
|
|
@@ -134,6 +134,7 @@ export interface ReviewSession {
|
|
|
134
134
|
result?: ReviewResult;
|
|
135
135
|
error?: Error;
|
|
136
136
|
metadata: SessionMetadata;
|
|
137
|
+
explorations?: ExplorationRecord[];
|
|
137
138
|
}
|
|
138
139
|
export interface ToolCallRecord {
|
|
139
140
|
timestamp: Date;
|
|
@@ -152,6 +153,33 @@ export interface SessionMetadata {
|
|
|
152
153
|
totalCost: number;
|
|
153
154
|
cacheHitRatio: number;
|
|
154
155
|
}
|
|
156
|
+
export interface ExplorationRecord {
|
|
157
|
+
task: string;
|
|
158
|
+
cacheKey: string;
|
|
159
|
+
focus: string[];
|
|
160
|
+
result: ExplorationResult;
|
|
161
|
+
createdAt: Date;
|
|
162
|
+
cached: boolean;
|
|
163
|
+
}
|
|
164
|
+
export interface ExplorationResult {
|
|
165
|
+
task: string;
|
|
166
|
+
summary: string;
|
|
167
|
+
findings: ExplorationFinding[];
|
|
168
|
+
evidence: ExplorationEvidence[];
|
|
169
|
+
openQuestions: string[];
|
|
170
|
+
recommendedNextStep: "continue_review" | "explore_more" | "avoid_commenting";
|
|
171
|
+
completedAt: string;
|
|
172
|
+
}
|
|
173
|
+
export interface ExplorationFinding {
|
|
174
|
+
claim: string;
|
|
175
|
+
confidence: "high" | "medium" | "low";
|
|
176
|
+
}
|
|
177
|
+
export interface ExplorationEvidence {
|
|
178
|
+
sourceType: "file" | "commit" | "diff" | "jira" | "memory" | "rules" | "kb";
|
|
179
|
+
ref: string;
|
|
180
|
+
snippet?: string;
|
|
181
|
+
reason: string;
|
|
182
|
+
}
|
|
155
183
|
export interface MCPToolResponse {
|
|
156
184
|
success: boolean;
|
|
157
185
|
data?: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/yama",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Enterprise-grade Pull Request automation toolkit with AI-powered code review and description enhancement",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pr",
|
|
@@ -89,9 +89,9 @@
|
|
|
89
89
|
"check:all": "npm run lint && npm run format --check && npm run validate && npm run validate:commit"
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@juspay/neurolink": "^9.
|
|
92
|
+
"@juspay/neurolink": "^9.42.0",
|
|
93
93
|
"langfuse": "^3.35.0",
|
|
94
|
-
"@nexus2520/bitbucket-mcp-server": "2.0.
|
|
94
|
+
"@nexus2520/bitbucket-mcp-server": "2.0.3",
|
|
95
95
|
"@nexus2520/jira-mcp-server": "^1.1.1",
|
|
96
96
|
"chalk": "^4.1.2",
|
|
97
97
|
"commander": "^11.0.0",
|
package/yama.config.example.yaml
CHANGED
|
@@ -36,6 +36,16 @@ ai:
|
|
|
36
36
|
maxTurnsPerSession: 300 # Long reviews need many turns
|
|
37
37
|
enableSummarization: false # Don't summarize mid-review
|
|
38
38
|
|
|
39
|
+
# Explore worker configuration
|
|
40
|
+
explore:
|
|
41
|
+
enabled: true
|
|
42
|
+
provider: "auto"
|
|
43
|
+
model: "gemini-2.5-flash"
|
|
44
|
+
temperature: 0.1
|
|
45
|
+
maxTokens: 32000
|
|
46
|
+
timeout: "5m"
|
|
47
|
+
cacheResults: true
|
|
48
|
+
|
|
39
49
|
# ============================================================================
|
|
40
50
|
# MCP Servers Configuration
|
|
41
51
|
# ============================================================================
|
|
@@ -231,6 +241,21 @@ knowledgeBase:
|
|
|
231
241
|
# Automatically commit knowledge base changes (with --commit flag)
|
|
232
242
|
autoCommit: false
|
|
233
243
|
|
|
244
|
+
# Per-repo condensed memory
|
|
245
|
+
# Memory accumulates durable facts about each repository across reviews
|
|
246
|
+
memory:
|
|
247
|
+
enabled: true
|
|
248
|
+
storagePath: ".yama/memory"
|
|
249
|
+
# Maximum word count for condensed memory per repository (default: 50)
|
|
250
|
+
maxWords: 200
|
|
251
|
+
# prompt: "Your custom condensation prompt here..."
|
|
252
|
+
# neurolink:
|
|
253
|
+
# provider: google-ai
|
|
254
|
+
# model: gemini-2.0-flash
|
|
255
|
+
# temperature: 0.1
|
|
256
|
+
autoCommit: true # Auto-commit memory files to repo after each review (persists across CI builds)
|
|
257
|
+
# commitMessage: "chore: update yama review memory [skip ci]"
|
|
258
|
+
|
|
234
259
|
# ============================================================================
|
|
235
260
|
# Project-Specific Standards (Override in your repository)
|
|
236
261
|
# ============================================================================
|