@juspay/yama 1.4.0 ā 1.5.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 +12 -0
- package/dist/core/Guardian.d.ts +1 -0
- package/dist/core/Guardian.js +15 -5
- package/dist/features/CodeReviewer.js +6 -2
- package/dist/types/index.d.ts +5 -0
- package/dist/utils/Logger.d.ts +3 -2
- package/dist/utils/Logger.js +8 -4
- package/package.json +1 -1
- package/yama.config.example.yaml +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
# [1.5.0](https://github.com/juspay/yama/compare/v1.4.1...v1.5.0) (2025-09-19)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- **summary:** Added config support for summary comment ([666ea5c](https://github.com/juspay/yama/commit/666ea5c78b93d2ef3df24a09f95581a4b8e75650))
|
|
6
|
+
|
|
7
|
+
## [1.4.1](https://github.com/juspay/yama/compare/v1.4.0...v1.4.1) (2025-09-18)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **config:** resolve config layering issue in Guardian initialization ([6a27428](https://github.com/juspay/yama/commit/6a2742863b73dee458f83eadc464f41290fe52d9))
|
|
12
|
+
|
|
1
13
|
# [1.4.0](https://github.com/juspay/yama/compare/v1.3.0...v1.4.0) (2025-09-18)
|
|
2
14
|
|
|
3
15
|
### Features
|
package/dist/core/Guardian.d.ts
CHANGED
package/dist/core/Guardian.js
CHANGED
|
@@ -7,7 +7,7 @@ import { BitbucketProvider } from "./providers/BitbucketProvider.js";
|
|
|
7
7
|
import { ContextGatherer } from "./ContextGatherer.js";
|
|
8
8
|
import { CodeReviewer } from "../features/CodeReviewer.js";
|
|
9
9
|
import { DescriptionEnhancer } from "../features/DescriptionEnhancer.js";
|
|
10
|
-
import { logger } from "../utils/Logger.js";
|
|
10
|
+
import { logger, createLogger } from "../utils/Logger.js";
|
|
11
11
|
import { configManager } from "../utils/ConfigManager.js";
|
|
12
12
|
import { cache } from "../utils/Cache.js";
|
|
13
13
|
export class Guardian {
|
|
@@ -18,6 +18,7 @@ export class Guardian {
|
|
|
18
18
|
descriptionEnhancer;
|
|
19
19
|
neurolink;
|
|
20
20
|
initialized = false;
|
|
21
|
+
logger = logger; // Default logger, will be updated after config load
|
|
21
22
|
constructor(config) {
|
|
22
23
|
this.config = {};
|
|
23
24
|
if (config) {
|
|
@@ -32,10 +33,19 @@ export class Guardian {
|
|
|
32
33
|
return;
|
|
33
34
|
}
|
|
34
35
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
this.config =
|
|
36
|
+
// Load configuration first
|
|
37
|
+
const loaded = await configManager.loadConfig(configPath);
|
|
38
|
+
// Loaded file first, then in-memory overrides last
|
|
39
|
+
this.config = { ...loaded, ...this.config };
|
|
40
|
+
// Create logger with banner configuration if needed
|
|
41
|
+
const showBanner = this.config.display?.showBanner ?? true;
|
|
42
|
+
if (showBanner !== true) {
|
|
43
|
+
// Only create a new logger if we need to change the banner setting
|
|
44
|
+
this.logger = createLogger(logger.getConfig(), showBanner);
|
|
45
|
+
}
|
|
46
|
+
// Otherwise, keep using the default logger
|
|
47
|
+
this.logger.badge();
|
|
48
|
+
this.logger.phase("š Initializing Yama...");
|
|
39
49
|
// Initialize providers
|
|
40
50
|
this.bitbucketProvider = new BitbucketProvider(this.config.providers.git.credentials);
|
|
41
51
|
await this.bitbucketProvider.initialize();
|
|
@@ -465,8 +465,9 @@ Return ONLY valid JSON:
|
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
// Post summary comment (include failed comments info if any)
|
|
469
|
-
|
|
468
|
+
// Post summary comment (include failed comments info if any) - only if enabled in config
|
|
469
|
+
const shouldPostSummary = this.reviewConfig.postSummaryComment !== false; // Default to true if not specified
|
|
470
|
+
if (uniqueViolations.length > 0 && shouldPostSummary) {
|
|
470
471
|
try {
|
|
471
472
|
const summaryComment = this.generateSummaryComment(uniqueViolations, context, failedComments);
|
|
472
473
|
await this.bitbucketProvider.addComment(context.identifier, summaryComment);
|
|
@@ -477,6 +478,9 @@ Return ONLY valid JSON:
|
|
|
477
478
|
logger.debug(`ā Failed to post summary comment: ${error.message}`);
|
|
478
479
|
}
|
|
479
480
|
}
|
|
481
|
+
else if (uniqueViolations.length > 0 && !shouldPostSummary) {
|
|
482
|
+
logger.debug("š Summary comment posting disabled in configuration");
|
|
483
|
+
}
|
|
480
484
|
logger.success(`ā
Posted ${commentsPosted} comments successfully`);
|
|
481
485
|
if (commentsFailed > 0) {
|
|
482
486
|
logger.warn(`ā ļø Failed to post ${commentsFailed} inline comments`);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -250,7 +250,11 @@ export interface EnhancementResult {
|
|
|
250
250
|
totalSections: number;
|
|
251
251
|
};
|
|
252
252
|
}
|
|
253
|
+
export interface DisplayConfig {
|
|
254
|
+
showBanner: boolean;
|
|
255
|
+
}
|
|
253
256
|
export interface GuardianConfig {
|
|
257
|
+
display?: DisplayConfig;
|
|
254
258
|
providers: {
|
|
255
259
|
ai: AIProviderConfig;
|
|
256
260
|
git: GitProviderConfig;
|
|
@@ -279,6 +283,7 @@ export interface CodeReviewConfig {
|
|
|
279
283
|
systemPrompt?: string;
|
|
280
284
|
analysisTemplate?: string;
|
|
281
285
|
focusAreas?: string[];
|
|
286
|
+
postSummaryComment?: boolean;
|
|
282
287
|
batchProcessing?: BatchProcessingConfig;
|
|
283
288
|
multiInstance?: MultiInstanceConfig;
|
|
284
289
|
semanticDeduplication?: SemanticDeduplicationConfig;
|
package/dist/utils/Logger.d.ts
CHANGED
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { Logger as ILogger, LogLevel, LoggerOptions } from "../types/index.js";
|
|
6
6
|
export declare class Logger implements ILogger {
|
|
7
7
|
private options;
|
|
8
|
-
|
|
8
|
+
private showBanner;
|
|
9
|
+
constructor(options?: Partial<LoggerOptions>, showBanner?: boolean);
|
|
9
10
|
private shouldLog;
|
|
10
11
|
private formatMessage;
|
|
11
12
|
private colorize;
|
|
@@ -26,5 +27,5 @@ export declare class Logger implements ILogger {
|
|
|
26
27
|
getConfig(): LoggerOptions;
|
|
27
28
|
}
|
|
28
29
|
export declare const logger: Logger;
|
|
29
|
-
export declare function createLogger(options?: Partial<LoggerOptions
|
|
30
|
+
export declare function createLogger(options?: Partial<LoggerOptions>, showBanner?: boolean): Logger;
|
|
30
31
|
//# sourceMappingURL=Logger.d.ts.map
|
package/dist/utils/Logger.js
CHANGED
|
@@ -16,7 +16,8 @@ const YAMA_BADGE = `
|
|
|
16
16
|
`;
|
|
17
17
|
export class Logger {
|
|
18
18
|
options;
|
|
19
|
-
|
|
19
|
+
showBanner;
|
|
20
|
+
constructor(options = {}, showBanner = true) {
|
|
20
21
|
this.options = {
|
|
21
22
|
level: "info",
|
|
22
23
|
verbose: false,
|
|
@@ -24,6 +25,7 @@ export class Logger {
|
|
|
24
25
|
colors: true,
|
|
25
26
|
...options,
|
|
26
27
|
};
|
|
28
|
+
this.showBanner = showBanner;
|
|
27
29
|
}
|
|
28
30
|
shouldLog(level) {
|
|
29
31
|
const levels = {
|
|
@@ -101,7 +103,9 @@ export class Logger {
|
|
|
101
103
|
console.error(this.colorize("error", formatted));
|
|
102
104
|
}
|
|
103
105
|
badge() {
|
|
104
|
-
|
|
106
|
+
if (this.showBanner) {
|
|
107
|
+
console.log(chalk.cyan(YAMA_BADGE));
|
|
108
|
+
}
|
|
105
109
|
}
|
|
106
110
|
phase(message) {
|
|
107
111
|
const formatted = `\nš ${message}`;
|
|
@@ -204,7 +208,7 @@ if (process.env.YAMA_DEBUG === "true") {
|
|
|
204
208
|
}
|
|
205
209
|
export const logger = new Logger(loggerOptions);
|
|
206
210
|
// Export factory function
|
|
207
|
-
export function createLogger(options) {
|
|
208
|
-
return new Logger(options);
|
|
211
|
+
export function createLogger(options, showBanner) {
|
|
212
|
+
return new Logger(options, showBanner);
|
|
209
213
|
}
|
|
210
214
|
//# sourceMappingURL=Logger.js.map
|
package/package.json
CHANGED
package/yama.config.example.yaml
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# Yama Configuration Example
|
|
2
2
|
# This file contains all available configuration options with explanations
|
|
3
3
|
|
|
4
|
+
# Display Configuration
|
|
5
|
+
display:
|
|
6
|
+
showBanner: true # Show ASCII art banner on startup (default: true)
|
|
7
|
+
|
|
4
8
|
# AI Provider Configuration
|
|
5
9
|
providers:
|
|
6
10
|
ai:
|
|
@@ -25,6 +29,7 @@ features:
|
|
|
25
29
|
# Code Review Configuration
|
|
26
30
|
codeReview:
|
|
27
31
|
enabled: true
|
|
32
|
+
postSummaryComment: true # Post summary comment at the end of review (default: true)
|
|
28
33
|
severityLevels: ["CRITICAL", "MAJOR", "MINOR", "SUGGESTION"]
|
|
29
34
|
categories:
|
|
30
35
|
[
|