@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Yama V2 CLI - AI-Native Code Review Interface
|
|
4
|
+
* Command-line interface for autonomous AI-powered code review
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
declare const program: Command;
|
|
8
|
+
/**
|
|
9
|
+
* Setup V2 CLI
|
|
10
|
+
*/
|
|
11
|
+
export declare function setupV2CLI(): Command;
|
|
12
|
+
export default program;
|
|
13
|
+
//# sourceMappingURL=v2.cli.d.ts.map
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Yama V2 CLI - AI-Native Code Review Interface
|
|
4
|
+
* Command-line interface for autonomous AI-powered code review
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from "commander";
|
|
7
|
+
import dotenv from "dotenv";
|
|
8
|
+
import { createYamaV2 } from "../v2/core/YamaV2Orchestrator.js";
|
|
9
|
+
import { createLearningOrchestrator } from "../v2/core/LearningOrchestrator.js";
|
|
10
|
+
// Load environment variables
|
|
11
|
+
dotenv.config();
|
|
12
|
+
const program = new Command();
|
|
13
|
+
/**
|
|
14
|
+
* Setup V2 CLI
|
|
15
|
+
*/
|
|
16
|
+
export function setupV2CLI() {
|
|
17
|
+
program
|
|
18
|
+
.name("yama")
|
|
19
|
+
.description("Yama - AI-Native Autonomous Code Review")
|
|
20
|
+
.version("2.0.0");
|
|
21
|
+
// Global options
|
|
22
|
+
program
|
|
23
|
+
.option("-v, --verbose", "Enable verbose output")
|
|
24
|
+
.option("-c, --config <path>", "Path to configuration file")
|
|
25
|
+
.option("--dry-run", "Dry run mode - no actual changes")
|
|
26
|
+
.option("--no-banner", "Hide Yama banner");
|
|
27
|
+
// Review command
|
|
28
|
+
setupReviewCommand();
|
|
29
|
+
// Enhance description command
|
|
30
|
+
setupEnhanceCommand();
|
|
31
|
+
// Learn from PR feedback command
|
|
32
|
+
setupLearnCommand();
|
|
33
|
+
// Init command
|
|
34
|
+
setupInitCommand();
|
|
35
|
+
// Migrate config command
|
|
36
|
+
setupMigrateCommand();
|
|
37
|
+
return program;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Main review command
|
|
41
|
+
* Reviews code and enhances description in one session
|
|
42
|
+
*/
|
|
43
|
+
function setupReviewCommand() {
|
|
44
|
+
program
|
|
45
|
+
.command("review")
|
|
46
|
+
.description("Review code and enhance PR description (uses same AI session)")
|
|
47
|
+
.requiredOption("-w, --workspace <workspace>", "Bitbucket workspace")
|
|
48
|
+
.requiredOption("-r, --repository <repository>", "Repository name")
|
|
49
|
+
.option("-p, --pr <id>", "Pull request ID")
|
|
50
|
+
.option("-b, --branch <branch>", "Branch name (finds PR automatically)")
|
|
51
|
+
.option("--review-only", "Skip description enhancement, only review code")
|
|
52
|
+
.action(async (options) => {
|
|
53
|
+
try {
|
|
54
|
+
const globalOpts = program.opts();
|
|
55
|
+
// Validate required options
|
|
56
|
+
if (!options.pr && !options.branch) {
|
|
57
|
+
console.error("❌ Error: Either --pr or --branch must be specified");
|
|
58
|
+
process.exit(1);
|
|
59
|
+
}
|
|
60
|
+
// Parse PR ID with validation
|
|
61
|
+
let pullRequestId;
|
|
62
|
+
if (options.pr) {
|
|
63
|
+
pullRequestId = parseInt(options.pr, 10);
|
|
64
|
+
if (isNaN(pullRequestId)) {
|
|
65
|
+
console.error(`❌ Error: Invalid PR ID "${options.pr}" (must be a number)`);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const request = {
|
|
70
|
+
workspace: options.workspace,
|
|
71
|
+
repository: options.repository,
|
|
72
|
+
pullRequestId,
|
|
73
|
+
branch: options.branch,
|
|
74
|
+
dryRun: globalOpts.dryRun || false,
|
|
75
|
+
verbose: globalOpts.verbose || false,
|
|
76
|
+
configPath: globalOpts.config,
|
|
77
|
+
};
|
|
78
|
+
// Create orchestrator
|
|
79
|
+
const yama = createYamaV2();
|
|
80
|
+
// Initialize
|
|
81
|
+
await yama.initialize(request.configPath);
|
|
82
|
+
// Start review (with or without description enhancement)
|
|
83
|
+
console.log("🚀 Starting autonomous AI review...\n");
|
|
84
|
+
const result = options.reviewOnly
|
|
85
|
+
? await yama.startReview(request)
|
|
86
|
+
: await yama.startReviewAndEnhance(request);
|
|
87
|
+
// Show results
|
|
88
|
+
console.log("\n📊 Review Results:");
|
|
89
|
+
console.log(` Decision: ${result.decision}`);
|
|
90
|
+
console.log(` Files Reviewed: ${result.statistics.filesReviewed}`);
|
|
91
|
+
console.log(` Total Comments: ${result.totalComments || result.statistics.totalComments || 0}`);
|
|
92
|
+
if (result.descriptionEnhanced !== undefined) {
|
|
93
|
+
console.log(` Description Enhanced: ${result.descriptionEnhanced ? "✅ Yes" : "⏭️ Skipped"}`);
|
|
94
|
+
}
|
|
95
|
+
console.log(` Duration: ${Math.round(result.duration / 1000)}s`);
|
|
96
|
+
console.log(` Token Usage: ${result.tokenUsage.total.toLocaleString()} tokens`);
|
|
97
|
+
if (globalOpts.verbose) {
|
|
98
|
+
console.log("\n📄 Full Results:");
|
|
99
|
+
console.log(JSON.stringify(result, null, 2));
|
|
100
|
+
}
|
|
101
|
+
// Exit with appropriate code
|
|
102
|
+
if (result.decision === "BLOCKED") {
|
|
103
|
+
process.exit(1);
|
|
104
|
+
}
|
|
105
|
+
else {
|
|
106
|
+
process.exit(0);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (error) {
|
|
110
|
+
console.error("\n❌ Review failed:", error.message);
|
|
111
|
+
if (error.stack && program.opts().verbose) {
|
|
112
|
+
console.error("\nStack trace:");
|
|
113
|
+
console.error(error.stack);
|
|
114
|
+
}
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Enhance description command
|
|
121
|
+
*/
|
|
122
|
+
function setupEnhanceCommand() {
|
|
123
|
+
program
|
|
124
|
+
.command("enhance")
|
|
125
|
+
.description("Enhance PR description using AI (without full review)")
|
|
126
|
+
.requiredOption("-w, --workspace <workspace>", "Bitbucket workspace")
|
|
127
|
+
.requiredOption("-r, --repository <repository>", "Repository name")
|
|
128
|
+
.option("-p, --pr <id>", "Pull request ID")
|
|
129
|
+
.option("-b, --branch <branch>", "Branch name")
|
|
130
|
+
.action(async (options) => {
|
|
131
|
+
try {
|
|
132
|
+
const globalOpts = program.opts();
|
|
133
|
+
if (!options.pr && !options.branch) {
|
|
134
|
+
console.error("❌ Error: Either --pr or --branch must be specified");
|
|
135
|
+
process.exit(1);
|
|
136
|
+
}
|
|
137
|
+
// Parse PR ID with validation
|
|
138
|
+
let pullRequestId;
|
|
139
|
+
if (options.pr) {
|
|
140
|
+
pullRequestId = parseInt(options.pr, 10);
|
|
141
|
+
if (isNaN(pullRequestId)) {
|
|
142
|
+
console.error(`❌ Error: Invalid PR ID "${options.pr}" (must be a number)`);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
const request = {
|
|
147
|
+
workspace: options.workspace,
|
|
148
|
+
repository: options.repository,
|
|
149
|
+
pullRequestId,
|
|
150
|
+
branch: options.branch,
|
|
151
|
+
dryRun: globalOpts.dryRun || false,
|
|
152
|
+
verbose: globalOpts.verbose || false,
|
|
153
|
+
configPath: globalOpts.config,
|
|
154
|
+
};
|
|
155
|
+
const yama = createYamaV2();
|
|
156
|
+
await yama.initialize(request.configPath);
|
|
157
|
+
const result = await yama.enhanceDescription(request);
|
|
158
|
+
console.log("\n✅ Description enhanced successfully");
|
|
159
|
+
console.log(JSON.stringify(result, null, 2));
|
|
160
|
+
process.exit(0);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
console.error("\n❌ Enhancement failed:", error.message);
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Learn from PR feedback command
|
|
170
|
+
* Extracts learnings from merged PRs to improve future reviews
|
|
171
|
+
*/
|
|
172
|
+
function setupLearnCommand() {
|
|
173
|
+
program
|
|
174
|
+
.command("learn")
|
|
175
|
+
.description("Extract learnings from merged PR to improve future reviews")
|
|
176
|
+
.requiredOption("-w, --workspace <workspace>", "Bitbucket workspace")
|
|
177
|
+
.requiredOption("-r, --repository <repository>", "Repository name")
|
|
178
|
+
.requiredOption("-p, --pr <id>", "Merged pull request ID")
|
|
179
|
+
.option("--commit", "Auto-commit knowledge base changes to git")
|
|
180
|
+
.option("--summarize", "Force summarization of knowledge base")
|
|
181
|
+
.option("--output <path>", "Override knowledge base output path")
|
|
182
|
+
.option("--format <format>", "Output format for dry-run preview (md|json)", "md")
|
|
183
|
+
.action(async (options) => {
|
|
184
|
+
try {
|
|
185
|
+
const globalOpts = program.opts();
|
|
186
|
+
// Parse and validate PR ID
|
|
187
|
+
const pullRequestId = parseInt(options.pr, 10);
|
|
188
|
+
if (isNaN(pullRequestId)) {
|
|
189
|
+
console.error(`❌ Error: Invalid PR ID "${options.pr}" (must be a number)`);
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|
|
192
|
+
// Validate format option
|
|
193
|
+
if (options.format && !["md", "json"].includes(options.format)) {
|
|
194
|
+
console.error(`❌ Error: Invalid format "${options.format}" (must be md or json)`);
|
|
195
|
+
process.exit(1);
|
|
196
|
+
}
|
|
197
|
+
const request = {
|
|
198
|
+
workspace: options.workspace,
|
|
199
|
+
repository: options.repository,
|
|
200
|
+
pullRequestId,
|
|
201
|
+
dryRun: globalOpts.dryRun || false,
|
|
202
|
+
commit: options.commit || false,
|
|
203
|
+
summarize: options.summarize || false,
|
|
204
|
+
outputPath: options.output,
|
|
205
|
+
outputFormat: options.format || "md",
|
|
206
|
+
};
|
|
207
|
+
// Create and initialize learning orchestrator
|
|
208
|
+
const orchestrator = createLearningOrchestrator();
|
|
209
|
+
await orchestrator.initialize(globalOpts.config);
|
|
210
|
+
// Extract learnings
|
|
211
|
+
const result = await orchestrator.extractLearnings(request);
|
|
212
|
+
// Handle result
|
|
213
|
+
if (!result.success) {
|
|
214
|
+
console.error(`\n❌ Learning extraction failed: ${result.error}`);
|
|
215
|
+
process.exit(1);
|
|
216
|
+
}
|
|
217
|
+
// Show final summary for live runs
|
|
218
|
+
if (!globalOpts.dryRun && result.learningsAdded > 0) {
|
|
219
|
+
console.log("\n🎉 Knowledge base updated successfully!");
|
|
220
|
+
console.log(` Use 'yama review' to apply these learnings to future reviews.`);
|
|
221
|
+
}
|
|
222
|
+
process.exit(0);
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
console.error("\n❌ Learning extraction failed:", error.message);
|
|
226
|
+
if (error.stack && program.opts().verbose) {
|
|
227
|
+
console.error("\nStack trace:");
|
|
228
|
+
console.error(error.stack);
|
|
229
|
+
}
|
|
230
|
+
process.exit(1);
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Initialize configuration command
|
|
236
|
+
*/
|
|
237
|
+
function setupInitCommand() {
|
|
238
|
+
program
|
|
239
|
+
.command("init")
|
|
240
|
+
.description("Initialize Yama configuration")
|
|
241
|
+
.option("--interactive", "Interactive configuration setup")
|
|
242
|
+
.action(async (options) => {
|
|
243
|
+
try {
|
|
244
|
+
console.log("\n⚔️ Yama Configuration Setup\n");
|
|
245
|
+
if (options.interactive) {
|
|
246
|
+
console.log("Interactive setup not yet implemented.");
|
|
247
|
+
console.log("Please copy yama.config.example.yaml to yama.config.yaml");
|
|
248
|
+
console.log("and edit it manually.\n");
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
console.log("Creating default configuration file...\n");
|
|
252
|
+
const fs = await import("fs/promises");
|
|
253
|
+
const path = await import("path");
|
|
254
|
+
// Check if config already exists
|
|
255
|
+
if (await fs
|
|
256
|
+
.access("yama.config.yaml")
|
|
257
|
+
.then(() => true)
|
|
258
|
+
.catch(() => false)) {
|
|
259
|
+
console.log("❌ yama.config.yaml already exists");
|
|
260
|
+
console.log(" Remove it first or use a different location\n");
|
|
261
|
+
process.exit(1);
|
|
262
|
+
}
|
|
263
|
+
// Copy example config
|
|
264
|
+
const examplePath = path.join(process.cwd(), "yama.config.example.yaml");
|
|
265
|
+
const targetPath = path.join(process.cwd(), "yama.config.yaml");
|
|
266
|
+
if (await fs
|
|
267
|
+
.access(examplePath)
|
|
268
|
+
.then(() => true)
|
|
269
|
+
.catch(() => false)) {
|
|
270
|
+
await fs.copyFile(examplePath, targetPath);
|
|
271
|
+
console.log("✅ Created yama.config.yaml from example");
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
console.log("⚠️ Example config not found, creating minimal config...");
|
|
275
|
+
await fs.writeFile(targetPath, `version: 2
|
|
276
|
+
configType: "yama-v2"
|
|
277
|
+
|
|
278
|
+
ai:
|
|
279
|
+
provider: "auto"
|
|
280
|
+
model: "gemini-2.5-pro"
|
|
281
|
+
|
|
282
|
+
mcpServers:
|
|
283
|
+
jira:
|
|
284
|
+
enabled: false
|
|
285
|
+
|
|
286
|
+
review:
|
|
287
|
+
enabled: true
|
|
288
|
+
|
|
289
|
+
descriptionEnhancement:
|
|
290
|
+
enabled: true
|
|
291
|
+
`);
|
|
292
|
+
console.log("✅ Created minimal yama.config.yaml");
|
|
293
|
+
}
|
|
294
|
+
console.log("\n📝 Next steps:");
|
|
295
|
+
console.log(" 1. Edit yama.config.yaml with your settings");
|
|
296
|
+
console.log(" 2. Set environment variables (BITBUCKET_*, JIRA_*)");
|
|
297
|
+
console.log(" 3. Run: yama review --help\n");
|
|
298
|
+
}
|
|
299
|
+
process.exit(0);
|
|
300
|
+
}
|
|
301
|
+
catch (error) {
|
|
302
|
+
console.error("\n❌ Initialization failed:", error.message);
|
|
303
|
+
process.exit(1);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Migrate V1 config to V2 format
|
|
309
|
+
*/
|
|
310
|
+
function setupMigrateCommand() {
|
|
311
|
+
program
|
|
312
|
+
.command("migrate-config")
|
|
313
|
+
.description("Migrate V1 configuration to V2 format")
|
|
314
|
+
.option("-i, --input <file>", "Input V1 config file", "yama.v1.config.yaml")
|
|
315
|
+
.option("-o, --output <file>", "Output V2 config file", "yama.config.yaml")
|
|
316
|
+
.option("--force", "Overwrite existing output file")
|
|
317
|
+
.action(async (options) => {
|
|
318
|
+
try {
|
|
319
|
+
const globalOpts = program.opts();
|
|
320
|
+
console.log("\n🔄 Yama V1 → V2 Configuration Migration\n");
|
|
321
|
+
// Use child_process to run the migration script
|
|
322
|
+
const { spawn } = await import("child_process");
|
|
323
|
+
const path = await import("path");
|
|
324
|
+
const { fileURLToPath } = await import("url");
|
|
325
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
326
|
+
const __dirname = path.dirname(__filename);
|
|
327
|
+
const scriptPath = path.resolve(__dirname, "../../scripts/migrate-config.cjs");
|
|
328
|
+
const args = ["--input", options.input, "--output", options.output];
|
|
329
|
+
if (options.force) {
|
|
330
|
+
args.push("--force");
|
|
331
|
+
}
|
|
332
|
+
if (globalOpts.dryRun) {
|
|
333
|
+
args.push("--dry-run");
|
|
334
|
+
}
|
|
335
|
+
const child = spawn("node", [scriptPath, ...args], {
|
|
336
|
+
stdio: "inherit",
|
|
337
|
+
cwd: process.cwd(),
|
|
338
|
+
});
|
|
339
|
+
child.on("close", (code) => {
|
|
340
|
+
process.exit(code || 0);
|
|
341
|
+
});
|
|
342
|
+
child.on("error", (err) => {
|
|
343
|
+
console.error("❌ Failed to run migration script:", err.message);
|
|
344
|
+
process.exit(1);
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
console.error("\n❌ Migration failed:", error.message);
|
|
349
|
+
process.exit(1);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
// Only run if this is the main module
|
|
354
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
355
|
+
const cli = setupV2CLI();
|
|
356
|
+
cli.parse(process.argv);
|
|
357
|
+
}
|
|
358
|
+
export default program;
|
|
359
|
+
//# sourceMappingURL=v2.cli.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Yama -
|
|
3
|
-
*
|
|
2
|
+
* Yama - AI-Native Code Review
|
|
3
|
+
* Main export file
|
|
4
4
|
*/
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export { main as cli } from "./cli/index.js";
|
|
5
|
+
export { YamaV2Orchestrator, createYamaV2, } from "./v2/core/YamaV2Orchestrator.js";
|
|
6
|
+
export { ConfigLoader } from "./v2/config/ConfigLoader.js";
|
|
7
|
+
export { MCPServerManager } from "./v2/core/MCPServerManager.js";
|
|
8
|
+
export { SessionManager } from "./v2/core/SessionManager.js";
|
|
9
|
+
export { PromptBuilder } from "./v2/prompts/PromptBuilder.js";
|
|
10
|
+
export type { ReviewRequest, ReviewResult, ReviewUpdate, ReviewSession, ReviewStatistics, IssuesBySeverity, TokenUsage, } from "./v2/types/v2.types.js";
|
|
11
|
+
export type { YamaV2Config, AIConfig, MCPServersConfig, ReviewConfig, DescriptionEnhancementConfig, } from "./v2/types/config.types.js";
|
|
12
|
+
export type { GetPullRequestResponse, GetPullRequestDiffResponse, GetIssueResponse, SearchCodeResponse, } from "./v2/types/mcp.types.js";
|
|
13
|
+
export declare const VERSION = "2.0.0";
|
|
14
|
+
export { createYamaV2 as default } from "./v2/core/YamaV2Orchestrator.js";
|
|
16
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Yama -
|
|
3
|
-
*
|
|
2
|
+
* Yama - AI-Native Code Review
|
|
3
|
+
* Main export file
|
|
4
4
|
*/
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
//
|
|
18
|
-
|
|
19
|
-
//
|
|
20
|
-
export {
|
|
21
|
-
// Note: Use named import { Guardian } from '@juspay/yama' instead
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// Core Exports
|
|
7
|
+
// ============================================================================
|
|
8
|
+
export { YamaV2Orchestrator, createYamaV2, } from "./v2/core/YamaV2Orchestrator.js";
|
|
9
|
+
export { ConfigLoader } from "./v2/config/ConfigLoader.js";
|
|
10
|
+
export { MCPServerManager } from "./v2/core/MCPServerManager.js";
|
|
11
|
+
export { SessionManager } from "./v2/core/SessionManager.js";
|
|
12
|
+
export { PromptBuilder } from "./v2/prompts/PromptBuilder.js";
|
|
13
|
+
// ============================================================================
|
|
14
|
+
// Version Information
|
|
15
|
+
// ============================================================================
|
|
16
|
+
export const VERSION = "2.0.0";
|
|
17
|
+
// ============================================================================
|
|
18
|
+
// Default Export
|
|
19
|
+
// ============================================================================
|
|
20
|
+
export { createYamaV2 as default } from "./v2/core/YamaV2Orchestrator.js";
|
|
22
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-Layer Configuration Loader for Yama V2
|
|
3
|
+
* Loads and merges configuration from multiple sources
|
|
4
|
+
*/
|
|
5
|
+
import { YamaV2Config } from "../types/config.types.js";
|
|
6
|
+
export declare class ConfigLoader {
|
|
7
|
+
private config;
|
|
8
|
+
private configPath;
|
|
9
|
+
/**
|
|
10
|
+
* Load configuration from file with multi-layer support
|
|
11
|
+
*/
|
|
12
|
+
loadConfig(configPath?: string): Promise<YamaV2Config>;
|
|
13
|
+
/**
|
|
14
|
+
* Get current loaded configuration
|
|
15
|
+
*/
|
|
16
|
+
getConfig(): YamaV2Config;
|
|
17
|
+
/**
|
|
18
|
+
* Validate configuration completeness and correctness
|
|
19
|
+
*/
|
|
20
|
+
validate(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve configuration file path
|
|
23
|
+
*/
|
|
24
|
+
private resolveConfigPath;
|
|
25
|
+
/**
|
|
26
|
+
* Load configuration from YAML file
|
|
27
|
+
*/
|
|
28
|
+
private loadConfigFile;
|
|
29
|
+
/**
|
|
30
|
+
* Deep merge two configuration objects
|
|
31
|
+
*/
|
|
32
|
+
private mergeConfigs;
|
|
33
|
+
/**
|
|
34
|
+
* Deep merge utility
|
|
35
|
+
*/
|
|
36
|
+
private deepMerge;
|
|
37
|
+
/**
|
|
38
|
+
* Check if value is an object
|
|
39
|
+
*/
|
|
40
|
+
private isObject;
|
|
41
|
+
/**
|
|
42
|
+
* Apply environment variable overrides
|
|
43
|
+
*/
|
|
44
|
+
private applyEnvironmentOverrides;
|
|
45
|
+
/**
|
|
46
|
+
* Basic configuration validation
|
|
47
|
+
*/
|
|
48
|
+
private validateConfig;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=ConfigLoader.d.ts.map
|