@juspay/yama 2.2.1 → 2.3.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/LICENSE +21 -0
- package/README.md +73 -110
- package/dist/cli/cli.d.ts +13 -0
- package/dist/cli/cli.js +341 -0
- package/dist/cli/v2.cli.d.ts +2 -11
- package/dist/cli/v2.cli.js +4 -354
- package/dist/index.d.ts +7 -5
- package/dist/index.js +5 -3
- package/dist/v2/config/ConfigLoader.d.ts +20 -5
- package/dist/v2/config/ConfigLoader.js +76 -24
- package/dist/v2/config/DefaultConfig.d.ts +3 -3
- package/dist/v2/config/DefaultConfig.js +9 -2
- package/dist/v2/core/LearningOrchestrator.d.ts +1 -0
- package/dist/v2/core/LearningOrchestrator.js +64 -4
- package/dist/v2/core/LocalDiffSource.d.ts +26 -0
- package/dist/v2/core/LocalDiffSource.js +129 -0
- package/dist/v2/core/MCPServerManager.d.ts +13 -1
- package/dist/v2/core/MCPServerManager.js +111 -7
- package/dist/v2/core/SessionManager.d.ts +1 -1
- package/dist/v2/core/SessionManager.js +3 -3
- package/dist/v2/core/YamaV2Orchestrator.d.ts +48 -13
- package/dist/v2/core/YamaV2Orchestrator.js +543 -63
- package/dist/v2/learning/types.d.ts +10 -0
- package/dist/v2/memory/MemoryManager.d.ts +57 -0
- package/dist/v2/memory/MemoryManager.js +185 -0
- package/dist/v2/prompts/PromptBuilder.d.ts +10 -4
- package/dist/v2/prompts/PromptBuilder.js +94 -3
- package/dist/v2/prompts/ReviewSystemPrompt.d.ts +1 -1
- package/dist/v2/prompts/ReviewSystemPrompt.js +7 -5
- package/dist/v2/types/config.types.d.ts +61 -1
- package/dist/v2/types/v2.types.d.ts +66 -5
- package/dist/v2/types/v2.types.js +8 -6
- package/package.json +20 -15
- package/yama.config.example.yaml +23 -5
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* AI-Native MCP Architecture Types
|
|
4
4
|
*/
|
|
5
5
|
export interface ReviewRequest {
|
|
6
|
+
mode: "pr";
|
|
6
7
|
workspace: string;
|
|
7
8
|
repository: string;
|
|
8
9
|
pullRequestId?: number;
|
|
@@ -10,8 +11,30 @@ export interface ReviewRequest {
|
|
|
10
11
|
dryRun?: boolean;
|
|
11
12
|
verbose?: boolean;
|
|
12
13
|
configPath?: string;
|
|
14
|
+
prompt?: string;
|
|
15
|
+
focus?: string[];
|
|
16
|
+
outputSchemaVersion?: string;
|
|
17
|
+
}
|
|
18
|
+
export type ReviewMode = "pr" | "local";
|
|
19
|
+
export type LocalDiffSource = "staged" | "uncommitted" | "range";
|
|
20
|
+
export interface LocalReviewRequest {
|
|
21
|
+
mode: "local";
|
|
22
|
+
repoPath?: string;
|
|
23
|
+
diffSource?: LocalDiffSource;
|
|
24
|
+
baseRef?: string;
|
|
25
|
+
headRef?: string;
|
|
26
|
+
includePaths?: string[];
|
|
27
|
+
dryRun?: boolean;
|
|
28
|
+
verbose?: boolean;
|
|
29
|
+
configPath?: string;
|
|
30
|
+
prompt?: string;
|
|
31
|
+
focus?: string[];
|
|
32
|
+
outputSchemaVersion?: string;
|
|
33
|
+
maxDiffChars?: number;
|
|
13
34
|
}
|
|
35
|
+
export type UnifiedReviewRequest = ReviewRequest | LocalReviewRequest;
|
|
14
36
|
export interface ReviewResult {
|
|
37
|
+
mode?: ReviewMode;
|
|
15
38
|
prId: number;
|
|
16
39
|
decision: "APPROVED" | "CHANGES_REQUESTED" | "BLOCKED";
|
|
17
40
|
statistics: ReviewStatistics;
|
|
@@ -23,6 +46,43 @@ export interface ReviewResult {
|
|
|
23
46
|
descriptionEnhanced?: boolean;
|
|
24
47
|
totalComments?: number;
|
|
25
48
|
}
|
|
49
|
+
export interface LocalReviewFinding {
|
|
50
|
+
id: string;
|
|
51
|
+
severity: "CRITICAL" | "MAJOR" | "MINOR" | "SUGGESTION";
|
|
52
|
+
category: string;
|
|
53
|
+
title: string;
|
|
54
|
+
description: string;
|
|
55
|
+
filePath?: string;
|
|
56
|
+
line?: number;
|
|
57
|
+
suggestion?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface LocalReviewResult {
|
|
60
|
+
mode: "local";
|
|
61
|
+
decision: "APPROVED" | "CHANGES_REQUESTED" | "BLOCKED";
|
|
62
|
+
summary: string;
|
|
63
|
+
issues: LocalReviewFinding[];
|
|
64
|
+
enhancements: LocalReviewFinding[];
|
|
65
|
+
statistics: {
|
|
66
|
+
filesChanged: number;
|
|
67
|
+
additions: number;
|
|
68
|
+
deletions: number;
|
|
69
|
+
issuesFound: number;
|
|
70
|
+
enhancementsFound: number;
|
|
71
|
+
issuesBySeverity: IssuesBySeverity;
|
|
72
|
+
};
|
|
73
|
+
duration: number;
|
|
74
|
+
tokenUsage: TokenUsage;
|
|
75
|
+
costEstimate: number;
|
|
76
|
+
sessionId: string;
|
|
77
|
+
schemaVersion: string;
|
|
78
|
+
metadata: {
|
|
79
|
+
repoPath: string;
|
|
80
|
+
diffSource: LocalDiffSource;
|
|
81
|
+
baseRef?: string;
|
|
82
|
+
headRef?: string;
|
|
83
|
+
truncated: boolean;
|
|
84
|
+
};
|
|
85
|
+
}
|
|
26
86
|
export interface ReviewStatistics {
|
|
27
87
|
filesReviewed: number;
|
|
28
88
|
issuesFound: IssuesBySeverity;
|
|
@@ -162,21 +222,22 @@ export interface AIAnalysisContext {
|
|
|
162
222
|
memoryBankContext?: string;
|
|
163
223
|
clinerules?: string;
|
|
164
224
|
}
|
|
165
|
-
export declare class
|
|
225
|
+
export declare class YamaError extends Error {
|
|
166
226
|
code: string;
|
|
167
227
|
context?: any | undefined;
|
|
168
228
|
constructor(code: string, message: string, context?: any | undefined);
|
|
169
229
|
}
|
|
170
|
-
export declare class MCPServerError extends
|
|
230
|
+
export declare class MCPServerError extends YamaError {
|
|
171
231
|
constructor(message: string, context?: any);
|
|
172
232
|
}
|
|
173
|
-
export declare class ConfigurationError extends
|
|
233
|
+
export declare class ConfigurationError extends YamaError {
|
|
174
234
|
constructor(message: string, context?: any);
|
|
175
235
|
}
|
|
176
|
-
export declare class ReviewTimeoutError extends
|
|
236
|
+
export declare class ReviewTimeoutError extends YamaError {
|
|
177
237
|
constructor(message: string, context?: any);
|
|
178
238
|
}
|
|
179
|
-
export declare class TokenBudgetExceededError extends
|
|
239
|
+
export declare class TokenBudgetExceededError extends YamaError {
|
|
180
240
|
constructor(message: string, context?: any);
|
|
181
241
|
}
|
|
242
|
+
export { YamaError as YamaV2Error };
|
|
182
243
|
//# sourceMappingURL=v2.types.d.ts.map
|
|
@@ -5,38 +5,40 @@
|
|
|
5
5
|
// ============================================================================
|
|
6
6
|
// Error Types
|
|
7
7
|
// ============================================================================
|
|
8
|
-
export class
|
|
8
|
+
export class YamaError extends Error {
|
|
9
9
|
code;
|
|
10
10
|
context;
|
|
11
11
|
constructor(code, message, context) {
|
|
12
12
|
super(message);
|
|
13
13
|
this.code = code;
|
|
14
14
|
this.context = context;
|
|
15
|
-
this.name = "
|
|
15
|
+
this.name = "YamaError";
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
export class MCPServerError extends
|
|
18
|
+
export class MCPServerError extends YamaError {
|
|
19
19
|
constructor(message, context) {
|
|
20
20
|
super("MCP_SERVER_ERROR", message, context);
|
|
21
21
|
this.name = "MCPServerError";
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
export class ConfigurationError extends
|
|
24
|
+
export class ConfigurationError extends YamaError {
|
|
25
25
|
constructor(message, context) {
|
|
26
26
|
super("CONFIGURATION_ERROR", message, context);
|
|
27
27
|
this.name = "ConfigurationError";
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
export class ReviewTimeoutError extends
|
|
30
|
+
export class ReviewTimeoutError extends YamaError {
|
|
31
31
|
constructor(message, context) {
|
|
32
32
|
super("REVIEW_TIMEOUT", message, context);
|
|
33
33
|
this.name = "ReviewTimeoutError";
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
export class TokenBudgetExceededError extends
|
|
36
|
+
export class TokenBudgetExceededError extends YamaError {
|
|
37
37
|
constructor(message, context) {
|
|
38
38
|
super("TOKEN_BUDGET_EXCEEDED", message, context);
|
|
39
39
|
this.name = "TokenBudgetExceededError";
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
+
// Backward-compatible alias.
|
|
43
|
+
export { YamaError as YamaV2Error };
|
|
42
44
|
//# sourceMappingURL=v2.types.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/yama",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Enterprise-grade Pull Request automation toolkit with AI-powered code review and description enhancement",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pr",
|
|
@@ -27,8 +27,14 @@
|
|
|
27
27
|
"type": "module",
|
|
28
28
|
"main": "dist/index.js",
|
|
29
29
|
"types": "dist/index.d.ts",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
30
36
|
"bin": {
|
|
31
|
-
"yama": "dist/cli/
|
|
37
|
+
"yama": "dist/cli/cli.js"
|
|
32
38
|
},
|
|
33
39
|
"directories": {
|
|
34
40
|
"test": "tests"
|
|
@@ -44,13 +50,13 @@
|
|
|
44
50
|
"CHANGELOG.md",
|
|
45
51
|
"LICENSE",
|
|
46
52
|
"yama.config.example.yaml",
|
|
47
|
-
".mcp-config.example.json"
|
|
48
|
-
"docs/v2"
|
|
53
|
+
".mcp-config.example.json"
|
|
49
54
|
],
|
|
50
55
|
"scripts": {
|
|
51
|
-
"build": "tsc && tsc-alias",
|
|
52
|
-
"dev": "tsx watch src/cli/
|
|
53
|
-
"dev:run": "tsx src/cli/
|
|
56
|
+
"build": "rimraf dist && tsc && tsc-alias",
|
|
57
|
+
"dev": "tsx watch src/cli/cli.ts",
|
|
58
|
+
"dev:run": "tsx src/cli/cli.ts",
|
|
59
|
+
"mcp:git:server": "uvx mcp-server-git || npx -y @modelcontextprotocol/server-git",
|
|
54
60
|
"test": "jest",
|
|
55
61
|
"lint": "eslint .",
|
|
56
62
|
"lint:fix": "eslint . --fix",
|
|
@@ -59,7 +65,7 @@
|
|
|
59
65
|
"format:check": "prettier --check .",
|
|
60
66
|
"docs": "typedoc src",
|
|
61
67
|
"clean": "rimraf dist",
|
|
62
|
-
"prepare": "husky
|
|
68
|
+
"prepare": "husky",
|
|
63
69
|
"prepack": "npm run build && npm run test",
|
|
64
70
|
"changeset": "changeset",
|
|
65
71
|
"changeset:version": "changeset version && git add --all",
|
|
@@ -83,10 +89,10 @@
|
|
|
83
89
|
"check:all": "npm run lint && npm run format --check && npm run validate && npm run validate:commit"
|
|
84
90
|
},
|
|
85
91
|
"dependencies": {
|
|
86
|
-
"@juspay/neurolink": "^9.
|
|
92
|
+
"@juspay/neurolink": "^9.42.0",
|
|
87
93
|
"langfuse": "^3.35.0",
|
|
88
|
-
"@nexus2520/bitbucket-mcp-server": "
|
|
89
|
-
"@nexus2520/jira-mcp-server": "^1.
|
|
94
|
+
"@nexus2520/bitbucket-mcp-server": "2.0.1",
|
|
95
|
+
"@nexus2520/jira-mcp-server": "^1.1.1",
|
|
90
96
|
"chalk": "^4.1.2",
|
|
91
97
|
"commander": "^11.0.0",
|
|
92
98
|
"debug": "^4.3.4",
|
|
@@ -108,7 +114,6 @@
|
|
|
108
114
|
"@semantic-release/github": "^11.0.0",
|
|
109
115
|
"@semantic-release/npm": "^12.0.1",
|
|
110
116
|
"@semantic-release/release-notes-generator": "^14.0.1",
|
|
111
|
-
"@types/commander": "^2.12.5",
|
|
112
117
|
"@types/inquirer": "^9.0.8",
|
|
113
118
|
"@types/jest": "^29.0.0",
|
|
114
119
|
"@types/lodash": "^4.14.0",
|
|
@@ -135,9 +140,9 @@
|
|
|
135
140
|
"typescript": ">=4.5.0"
|
|
136
141
|
},
|
|
137
142
|
"engines": {
|
|
138
|
-
"node": ">=18.
|
|
139
|
-
"npm": ">=
|
|
140
|
-
"pnpm": ">=
|
|
143
|
+
"node": ">=20.18.1",
|
|
144
|
+
"npm": ">=10.0.0",
|
|
145
|
+
"pnpm": ">=9.0.0"
|
|
141
146
|
},
|
|
142
147
|
"os": [
|
|
143
148
|
"darwin",
|
package/yama.config.example.yaml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# Copy this file to yama.config.yaml and customize for your project
|
|
3
3
|
|
|
4
4
|
version: 2
|
|
5
|
-
configType: "yama
|
|
5
|
+
configType: "yama"
|
|
6
6
|
|
|
7
7
|
# ============================================================================
|
|
8
8
|
# Display & Streaming Configuration
|
|
@@ -25,6 +25,8 @@ ai:
|
|
|
25
25
|
enableEvaluation: false # Enable quality evaluation (slower)
|
|
26
26
|
timeout: "15m" # Maximum time for review
|
|
27
27
|
retryAttempts: 3 # Number of retries on failure
|
|
28
|
+
enableToolFiltering: false # Enable query-level MCP tool filtering
|
|
29
|
+
toolFilteringMode: "off" # off | log-only | active
|
|
28
30
|
|
|
29
31
|
# Conversation memory for maintaining review state
|
|
30
32
|
conversationMemory:
|
|
@@ -48,16 +50,17 @@ mcpServers:
|
|
|
48
50
|
# Example blocked tools (uncomment to use):
|
|
49
51
|
# - merge_pull_request # Prevent AI from merging PRs
|
|
50
52
|
# - delete_branch # Prevent AI from deleting branches
|
|
51
|
-
# -
|
|
53
|
+
# - set_pr_approval # Prevent AI from changing approval status
|
|
54
|
+
# - set_review_status # Prevent AI from requesting/removing changes
|
|
52
55
|
|
|
53
56
|
jira:
|
|
54
57
|
enabled: true # Set to false to disable Jira integration
|
|
55
58
|
# Optional: Block specific Jira tools from AI access
|
|
56
59
|
blockedTools: []
|
|
57
60
|
# Example blocked tools (uncomment to use):
|
|
58
|
-
# -
|
|
59
|
-
# -
|
|
60
|
-
# -
|
|
61
|
+
# - jira_issues # Block issue get/create/update/assign actions
|
|
62
|
+
# - jira_search # Block issue/project/user/metadata search
|
|
63
|
+
# - jira_comments # Block reading/adding issue comments
|
|
61
64
|
|
|
62
65
|
# ============================================================================
|
|
63
66
|
# Review Configuration
|
|
@@ -228,6 +231,21 @@ knowledgeBase:
|
|
|
228
231
|
# Automatically commit knowledge base changes (with --commit flag)
|
|
229
232
|
autoCommit: false
|
|
230
233
|
|
|
234
|
+
# Per-repo condensed memory
|
|
235
|
+
# Memory accumulates durable facts about each repository across reviews
|
|
236
|
+
memory:
|
|
237
|
+
enabled: true
|
|
238
|
+
storagePath: ".yama/memory"
|
|
239
|
+
# Maximum word count for condensed memory per repository (default: 50)
|
|
240
|
+
maxWords: 200
|
|
241
|
+
# prompt: "Your custom condensation prompt here..."
|
|
242
|
+
# neurolink:
|
|
243
|
+
# provider: google-ai
|
|
244
|
+
# model: gemini-2.0-flash
|
|
245
|
+
# temperature: 0.1
|
|
246
|
+
autoCommit: true # Auto-commit memory files to repo after each review (persists across CI builds)
|
|
247
|
+
# commitMessage: "chore: update yama review memory [skip ci]"
|
|
248
|
+
|
|
231
249
|
# ============================================================================
|
|
232
250
|
# Project-Specific Standards (Override in your repository)
|
|
233
251
|
# ============================================================================
|