@juspay/yama 1.1.0 → 1.1.1
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 +27 -1
- package/README.md +151 -119
- package/dist/cli/index.js +201 -200
- package/dist/core/ContextGatherer.d.ts +3 -3
- package/dist/core/ContextGatherer.js +145 -149
- package/dist/core/Guardian.d.ts +1 -1
- package/dist/core/Guardian.js +122 -122
- package/dist/core/providers/BitbucketProvider.d.ts +3 -3
- package/dist/core/providers/BitbucketProvider.js +129 -121
- package/dist/features/CodeReviewer.d.ts +3 -3
- package/dist/features/CodeReviewer.js +290 -221
- package/dist/features/DescriptionEnhancer.d.ts +3 -3
- package/dist/features/DescriptionEnhancer.js +115 -94
- package/dist/index.d.ts +11 -11
- package/dist/index.js +10 -48
- package/dist/types/index.d.ts +21 -21
- package/dist/types/index.js +13 -18
- package/dist/utils/Cache.d.ts +1 -1
- package/dist/utils/Cache.js +62 -68
- package/dist/utils/ConfigManager.d.ts +1 -1
- package/dist/utils/ConfigManager.js +281 -253
- package/dist/utils/Logger.d.ts +2 -2
- package/dist/utils/Logger.js +69 -67
- package/package.json +7 -6
- package/yama.config.example.yaml +28 -21
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Enhanced Description Enhancer - Optimized to work with Unified Context
|
|
3
3
|
* Preserves all original functionality from pr-describe.js but optimized
|
|
4
4
|
*/
|
|
5
|
-
import { EnhancementOptions, EnhancementResult, AIProviderConfig } from
|
|
6
|
-
import { UnifiedContext } from
|
|
7
|
-
import { BitbucketProvider } from
|
|
5
|
+
import { EnhancementOptions, EnhancementResult, AIProviderConfig } from "../types/index.js";
|
|
6
|
+
import { UnifiedContext } from "../core/ContextGatherer.js";
|
|
7
|
+
import { BitbucketProvider } from "../core/providers/BitbucketProvider.js";
|
|
8
8
|
export declare class DescriptionEnhancer {
|
|
9
9
|
private neurolink;
|
|
10
10
|
private bitbucketProvider;
|
|
@@ -1,20 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Enhanced Description Enhancer - Optimized to work with Unified Context
|
|
4
3
|
* Preserves all original functionality from pr-describe.js but optimized
|
|
5
4
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
import { ProviderError, } from "../types/index.js";
|
|
6
|
+
import { logger } from "../utils/Logger.js";
|
|
7
|
+
export class DescriptionEnhancer {
|
|
8
|
+
neurolink;
|
|
9
|
+
bitbucketProvider;
|
|
10
|
+
aiConfig;
|
|
11
|
+
defaultRequiredSections = [
|
|
12
|
+
{ key: "changelog", name: "Changelog (Modules Modified)", required: true },
|
|
13
|
+
{
|
|
14
|
+
key: "testcases",
|
|
15
|
+
name: "Test Cases (What to be tested)",
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
key: "config_changes",
|
|
20
|
+
name: "CAC Config Or Service Config Changes",
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
];
|
|
12
24
|
constructor(bitbucketProvider, aiConfig) {
|
|
13
|
-
this.defaultRequiredSections = [
|
|
14
|
-
{ key: 'changelog', name: 'Changelog (Modules Modified)', required: true },
|
|
15
|
-
{ key: 'testcases', name: 'Test Cases (What to be tested)', required: true },
|
|
16
|
-
{ key: 'config_changes', name: 'CAC Config Or Service Config Changes', required: true }
|
|
17
|
-
];
|
|
18
25
|
this.bitbucketProvider = bitbucketProvider;
|
|
19
26
|
this.aiConfig = aiConfig;
|
|
20
27
|
}
|
|
@@ -24,11 +31,11 @@ class DescriptionEnhancer {
|
|
|
24
31
|
async enhanceWithContext(context, options) {
|
|
25
32
|
const startTime = Date.now();
|
|
26
33
|
try {
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
logger.phase("📝 Enhancing PR description...");
|
|
35
|
+
logger.info(`Processing PR #${context.pr.id}: "${context.pr.title}"`);
|
|
29
36
|
// Step 1: Analyze existing content and identify what needs enhancement
|
|
30
37
|
const analysisResult = this.analyzeExistingContent(context.pr.description, options.customSections || this.defaultRequiredSections);
|
|
31
|
-
|
|
38
|
+
logger.info(`Content analysis: ${analysisResult.preservedContent.media.length} media items, ` +
|
|
32
39
|
`${analysisResult.missingCount} missing sections`);
|
|
33
40
|
// Step 2: Generate enhanced description using AI
|
|
34
41
|
const enhancedDescription = await this.generateEnhancedDescription(context, analysisResult, options);
|
|
@@ -41,32 +48,32 @@ class DescriptionEnhancer {
|
|
|
41
48
|
}
|
|
42
49
|
const duration = Math.round((Date.now() - startTime) / 1000);
|
|
43
50
|
const result = this.generateEnhancementResult(context.pr.description, enhancedDescription, analysisResult, duration);
|
|
44
|
-
|
|
51
|
+
logger.success(`Description enhancement completed in ${duration}s: ` +
|
|
45
52
|
`${result.sectionsAdded.length} sections added, ${result.sectionsEnhanced.length} enhanced`);
|
|
46
53
|
return result;
|
|
47
54
|
}
|
|
48
55
|
catch (error) {
|
|
49
|
-
|
|
50
|
-
throw new
|
|
56
|
+
logger.error(`Description enhancement failed: ${error.message}`);
|
|
57
|
+
throw new ProviderError(`Description enhancement failed: ${error.message}`);
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
/**
|
|
54
61
|
* Analyze existing PR description content
|
|
55
62
|
*/
|
|
56
63
|
analyzeExistingContent(description, requiredSections) {
|
|
57
|
-
|
|
64
|
+
logger.debug("Analyzing existing PR description content...");
|
|
58
65
|
// Extract preservable content (media, files, links)
|
|
59
66
|
const preservedContent = this.extractPreservableContent(description);
|
|
60
67
|
// Validate required sections
|
|
61
68
|
const sectionsAnalysis = this.validateRequiredSections(description, requiredSections);
|
|
62
|
-
const missingCount = sectionsAnalysis.filter(s => !s.present).length;
|
|
69
|
+
const missingCount = sectionsAnalysis.filter((s) => !s.present).length;
|
|
63
70
|
// Identify content gaps
|
|
64
71
|
const gaps = this.identifyContentGaps(description);
|
|
65
72
|
return {
|
|
66
73
|
requiredSections: sectionsAnalysis,
|
|
67
74
|
missingCount,
|
|
68
75
|
preservedContent,
|
|
69
|
-
gaps
|
|
76
|
+
gaps,
|
|
70
77
|
};
|
|
71
78
|
}
|
|
72
79
|
/**
|
|
@@ -77,7 +84,7 @@ class DescriptionEnhancer {
|
|
|
77
84
|
media: [],
|
|
78
85
|
files: [],
|
|
79
86
|
links: [],
|
|
80
|
-
originalText: description ||
|
|
87
|
+
originalText: description || "",
|
|
81
88
|
};
|
|
82
89
|
if (!description) {
|
|
83
90
|
return preservableContent;
|
|
@@ -91,8 +98,8 @@ class DescriptionEnhancer {
|
|
|
91
98
|
// Extract links (excluding images and files)
|
|
92
99
|
const linkRegex = /\[[^\]]*\]\([^)]+\)/g;
|
|
93
100
|
const allLinks = description.match(linkRegex) || [];
|
|
94
|
-
preservableContent.links = allLinks.filter(link => !mediaRegex.test(link) && !fileRegex.test(link));
|
|
95
|
-
|
|
101
|
+
preservableContent.links = allLinks.filter((link) => !mediaRegex.test(link) && !fileRegex.test(link));
|
|
102
|
+
logger.debug(`Preservable content: ${preservableContent.media.length} media, ` +
|
|
96
103
|
`${preservableContent.files.length} files, ${preservableContent.links.length} links`);
|
|
97
104
|
return preservableContent;
|
|
98
105
|
}
|
|
@@ -101,10 +108,10 @@ class DescriptionEnhancer {
|
|
|
101
108
|
*/
|
|
102
109
|
validateRequiredSections(description, requiredSections) {
|
|
103
110
|
if (!description) {
|
|
104
|
-
return requiredSections.map(section => ({
|
|
111
|
+
return requiredSections.map((section) => ({
|
|
105
112
|
...section,
|
|
106
113
|
present: false,
|
|
107
|
-
content:
|
|
114
|
+
content: "",
|
|
108
115
|
}));
|
|
109
116
|
}
|
|
110
117
|
const sectionPatterns = {
|
|
@@ -112,28 +119,32 @@ class DescriptionEnhancer {
|
|
|
112
119
|
/##.*?[Cc]hangelog/i,
|
|
113
120
|
/##.*?[Mm]odules?\s+[Mm]odified/i,
|
|
114
121
|
/##.*?[Cc]hanges?\s+[Mm]ade/i,
|
|
115
|
-
/📋.*?[Cc]hangelog/i
|
|
122
|
+
/📋.*?[Cc]hangelog/i,
|
|
116
123
|
],
|
|
117
124
|
testcases: [
|
|
118
125
|
/##.*?[Tt]est\s+[Cc]ases?/i,
|
|
119
126
|
/##.*?[Tt]esting/i,
|
|
120
127
|
/🧪.*?[Tt]est/i,
|
|
121
|
-
/##.*?[Tt]est\s+[Pp]lan/i
|
|
128
|
+
/##.*?[Tt]est\s+[Pp]lan/i,
|
|
122
129
|
],
|
|
123
130
|
config_changes: [
|
|
124
131
|
/##.*?[Cc]onfig/i,
|
|
125
132
|
/##.*?CAC/i,
|
|
126
133
|
/##.*?[Ss]ervice\s+[Cc]onfig/i,
|
|
127
|
-
/⚙️.*?[Cc]onfig/i
|
|
128
|
-
]
|
|
134
|
+
/⚙️.*?[Cc]onfig/i,
|
|
135
|
+
],
|
|
129
136
|
};
|
|
130
|
-
return requiredSections.map(section => {
|
|
137
|
+
return requiredSections.map((section) => {
|
|
131
138
|
const patterns = sectionPatterns[section.key];
|
|
132
|
-
const isPresent = patterns
|
|
139
|
+
const isPresent = patterns
|
|
140
|
+
? patterns.some((pattern) => pattern.test(description))
|
|
141
|
+
: false;
|
|
133
142
|
return {
|
|
134
143
|
...section,
|
|
135
144
|
present: isPresent,
|
|
136
|
-
content: isPresent
|
|
145
|
+
content: isPresent
|
|
146
|
+
? this.extractSectionContent(description, patterns || [])
|
|
147
|
+
: "",
|
|
137
148
|
};
|
|
138
149
|
});
|
|
139
150
|
}
|
|
@@ -145,12 +156,16 @@ class DescriptionEnhancer {
|
|
|
145
156
|
const match = description.match(pattern);
|
|
146
157
|
if (match) {
|
|
147
158
|
const startIndex = match.index + match[0].length;
|
|
148
|
-
const nextHeaderIndex = description
|
|
149
|
-
|
|
159
|
+
const nextHeaderIndex = description
|
|
160
|
+
.substring(startIndex)
|
|
161
|
+
.search(/\n##/);
|
|
162
|
+
const endIndex = nextHeaderIndex === -1
|
|
163
|
+
? description.length
|
|
164
|
+
: startIndex + nextHeaderIndex;
|
|
150
165
|
return description.substring(startIndex, endIndex).trim();
|
|
151
166
|
}
|
|
152
167
|
}
|
|
153
|
-
return
|
|
168
|
+
return "";
|
|
154
169
|
}
|
|
155
170
|
/**
|
|
156
171
|
* Identify content gaps (TODOs, unanswered questions, etc.)
|
|
@@ -158,19 +173,19 @@ class DescriptionEnhancer {
|
|
|
158
173
|
identifyContentGaps(description) {
|
|
159
174
|
const gaps = [];
|
|
160
175
|
if (!description) {
|
|
161
|
-
gaps.push(
|
|
176
|
+
gaps.push("No description provided");
|
|
162
177
|
return gaps;
|
|
163
178
|
}
|
|
164
179
|
// Check for unanswered questions and placeholders
|
|
165
180
|
const gapMarkers = [
|
|
166
|
-
{ pattern: /\?\s*$/gm, name:
|
|
167
|
-
{ pattern: /TODO/gi, name:
|
|
168
|
-
{ pattern: /FIXME/gi, name:
|
|
169
|
-
{ pattern: /\[TBD\]/gi, name:
|
|
170
|
-
{ pattern: /\[TO BE DETERMINED\]/gi, name:
|
|
171
|
-
{ pattern: /\[PENDING\]/gi, name:
|
|
181
|
+
{ pattern: /\?\s*$/gm, name: "unanswered questions" },
|
|
182
|
+
{ pattern: /TODO/gi, name: "TODO items" },
|
|
183
|
+
{ pattern: /FIXME/gi, name: "FIXME items" },
|
|
184
|
+
{ pattern: /\[TBD\]/gi, name: "TBD placeholders" },
|
|
185
|
+
{ pattern: /\[TO BE DETERMINED\]/gi, name: "TBD placeholders" },
|
|
186
|
+
{ pattern: /\[PENDING\]/gi, name: "pending items" },
|
|
172
187
|
];
|
|
173
|
-
gapMarkers.forEach(marker => {
|
|
188
|
+
gapMarkers.forEach((marker) => {
|
|
174
189
|
const matches = description.match(marker.pattern);
|
|
175
190
|
if (matches) {
|
|
176
191
|
gaps.push(`${matches.length} ${marker.name}`);
|
|
@@ -182,11 +197,10 @@ class DescriptionEnhancer {
|
|
|
182
197
|
* Generate enhanced description using AI and unified context
|
|
183
198
|
*/
|
|
184
199
|
async generateEnhancedDescription(context, analysisResult, options) {
|
|
185
|
-
|
|
200
|
+
logger.debug("Generating AI-enhanced description...");
|
|
186
201
|
// Initialize NeuroLink with eval-based dynamic import
|
|
187
202
|
if (!this.neurolink) {
|
|
188
|
-
const
|
|
189
|
-
const { NeuroLink } = await dynamicImport('@juspay/neurolink');
|
|
203
|
+
const { NeuroLink } = await import("@juspay/neurolink");
|
|
190
204
|
this.neurolink = new NeuroLink();
|
|
191
205
|
}
|
|
192
206
|
const enhancementPrompt = this.buildEnhancementPrompt(context, analysisResult, options);
|
|
@@ -197,33 +211,36 @@ class DescriptionEnhancer {
|
|
|
197
211
|
model: this.aiConfig.model,
|
|
198
212
|
temperature: this.aiConfig.temperature || 0.7,
|
|
199
213
|
maxTokens: this.aiConfig.maxTokens || 1000000,
|
|
200
|
-
timeout:
|
|
214
|
+
timeout: "8m", // Longer timeout for description generation
|
|
201
215
|
enableAnalytics: this.aiConfig.enableAnalytics,
|
|
202
|
-
enableEvaluation: this.aiConfig.enableEvaluation
|
|
216
|
+
enableEvaluation: this.aiConfig.enableEvaluation,
|
|
203
217
|
});
|
|
204
|
-
let enhancedDescription = result.content ||
|
|
218
|
+
let enhancedDescription = result.content ||
|
|
219
|
+
result.text ||
|
|
220
|
+
result.response ||
|
|
221
|
+
"";
|
|
205
222
|
// Clean up any markdown code blocks if AI wrapped the response
|
|
206
223
|
enhancedDescription = enhancedDescription
|
|
207
|
-
.replace(/^```markdown\s*/,
|
|
208
|
-
.replace(/\s*```$/,
|
|
224
|
+
.replace(/^```markdown\s*/, "")
|
|
225
|
+
.replace(/\s*```$/, "")
|
|
209
226
|
.trim();
|
|
210
227
|
if (!enhancedDescription) {
|
|
211
|
-
throw new Error(
|
|
228
|
+
throw new Error("AI generated empty description");
|
|
212
229
|
}
|
|
213
230
|
// Validate that required sections are present after enhancement
|
|
214
231
|
const finalValidation = this.validateRequiredSections(enhancedDescription, options.customSections || this.defaultRequiredSections);
|
|
215
|
-
const stillMissing = finalValidation.filter(s => !s.present);
|
|
232
|
+
const stillMissing = finalValidation.filter((s) => !s.present);
|
|
216
233
|
if (stillMissing.length > 0) {
|
|
217
|
-
|
|
234
|
+
logger.warn(`Warning: ${stillMissing.length} required sections still missing after AI enhancement`);
|
|
218
235
|
}
|
|
219
236
|
return enhancedDescription;
|
|
220
237
|
}
|
|
221
238
|
catch (error) {
|
|
222
|
-
if (error.message?.includes(
|
|
223
|
-
|
|
224
|
-
throw new Error(
|
|
239
|
+
if (error.message?.includes("timeout")) {
|
|
240
|
+
logger.error("⏰ Description enhancement timed out after 8 minutes");
|
|
241
|
+
throw new Error("Enhancement timeout - try with smaller diff or adjust timeout");
|
|
225
242
|
}
|
|
226
|
-
|
|
243
|
+
logger.error(`AI description generation failed: ${error.message}`);
|
|
227
244
|
throw error;
|
|
228
245
|
}
|
|
229
246
|
}
|
|
@@ -232,12 +249,13 @@ class DescriptionEnhancer {
|
|
|
232
249
|
*/
|
|
233
250
|
buildEnhancementPrompt(context, analysisResult, _options) {
|
|
234
251
|
// Prepare diff information based on strategy
|
|
235
|
-
let diffInfo =
|
|
236
|
-
if (context.diffStrategy.strategy ===
|
|
252
|
+
let diffInfo = "";
|
|
253
|
+
if (context.diffStrategy.strategy === "whole" && context.prDiff) {
|
|
237
254
|
diffInfo = `**Diff Strategy**: Whole PR diff (${context.diffStrategy.fileCount} files)
|
|
238
255
|
**Changes**: ${JSON.stringify(context.prDiff.fileChanges?.slice(0, 20) || [], null, 2)}`;
|
|
239
256
|
}
|
|
240
|
-
else if (context.diffStrategy.strategy ===
|
|
257
|
+
else if (context.diffStrategy.strategy === "file-by-file" &&
|
|
258
|
+
context.fileDiffs) {
|
|
241
259
|
const fileList = Array.from(context.fileDiffs.keys()).slice(0, 20);
|
|
242
260
|
diffInfo = `**Diff Strategy**: File-by-file analysis (${context.diffStrategy.fileCount} files)
|
|
243
261
|
**Modified Files**: ${JSON.stringify(fileList, null, 2)}`;
|
|
@@ -248,7 +266,7 @@ class DescriptionEnhancer {
|
|
|
248
266
|
**Title**: ${context.pr.title}
|
|
249
267
|
**Author**: ${context.pr.author}
|
|
250
268
|
**Current Description**:
|
|
251
|
-
${analysisResult.preservedContent.originalText ||
|
|
269
|
+
${analysisResult.preservedContent.originalText || "[No existing description]"}
|
|
252
270
|
|
|
253
271
|
## CODE CHANGES ANALYSIS:
|
|
254
272
|
${diffInfo}
|
|
@@ -257,16 +275,16 @@ ${diffInfo}
|
|
|
257
275
|
${context.projectContext.memoryBank.summary}
|
|
258
276
|
|
|
259
277
|
## PROJECT RULES:
|
|
260
|
-
${context.projectContext.clinerules ||
|
|
278
|
+
${context.projectContext.clinerules || "No specific rules defined"}
|
|
261
279
|
|
|
262
280
|
## CONTENT PRESERVATION REQUIREMENTS:
|
|
263
281
|
**CRITICAL**: This is content ENHANCEMENT, not replacement!
|
|
264
282
|
|
|
265
283
|
### Preserved Content Analysis:
|
|
266
|
-
- **Media Items**: ${analysisResult.preservedContent.media.length} (${analysisResult.preservedContent.media.join(
|
|
267
|
-
- **File Attachments**: ${analysisResult.preservedContent.files.length} (${analysisResult.preservedContent.files.join(
|
|
284
|
+
- **Media Items**: ${analysisResult.preservedContent.media.length} (${analysisResult.preservedContent.media.join(", ")})
|
|
285
|
+
- **File Attachments**: ${analysisResult.preservedContent.files.length} (${analysisResult.preservedContent.files.join(", ")})
|
|
268
286
|
- **Links**: ${analysisResult.preservedContent.links.length}
|
|
269
|
-
- **Content Gaps**: ${analysisResult.gaps.join(
|
|
287
|
+
- **Content Gaps**: ${analysisResult.gaps.join(", ") || "None identified"}
|
|
270
288
|
|
|
271
289
|
### PRESERVATION RULES:
|
|
272
290
|
- **NEVER REMOVE**: Screenshots, images, file attachments, existing explanations, or links
|
|
@@ -275,11 +293,13 @@ ${context.projectContext.clinerules || 'No specific rules defined'}
|
|
|
275
293
|
- **MAINTAIN**: Original structure, tone, and author's explanations
|
|
276
294
|
|
|
277
295
|
## REQUIRED SECTIONS STATUS:
|
|
278
|
-
${analysisResult.requiredSections
|
|
296
|
+
${analysisResult.requiredSections
|
|
297
|
+
.map((section) => `
|
|
279
298
|
**${section.name}**:
|
|
280
|
-
- Present: ${section.present ?
|
|
281
|
-
- Content: ${section.content ? `"${section.content.substring(0, 100)}..."` :
|
|
282
|
-
- Action Needed: ${section.present ? ((section.content?.length || 0) < 50 ?
|
|
299
|
+
- Present: ${section.present ? "✅ Yes" : "❌ Missing"}
|
|
300
|
+
- Content: ${section.content ? `"${section.content.substring(0, 100)}..."` : "None"}
|
|
301
|
+
- Action Needed: ${section.present ? ((section.content?.length || 0) < 50 ? "Enhancement" : "None") : "Add Section"}`)
|
|
302
|
+
.join("")}
|
|
283
303
|
|
|
284
304
|
## REQUIRED SECTIONS TO IMPLEMENT:
|
|
285
305
|
|
|
@@ -347,31 +367,31 @@ Generate the enhanced description now, ensuring ALL preservation requirements ar
|
|
|
347
367
|
* Update PR description in Bitbucket
|
|
348
368
|
*/
|
|
349
369
|
async updatePRDescription(context, enhancedDescription) {
|
|
350
|
-
|
|
370
|
+
logger.debug(`Updating PR description for #${context.pr.id}...`);
|
|
351
371
|
try {
|
|
352
372
|
await this.bitbucketProvider.updatePRDescription(context.identifier, enhancedDescription);
|
|
353
|
-
|
|
373
|
+
logger.success("✅ PR description updated successfully");
|
|
354
374
|
}
|
|
355
375
|
catch (error) {
|
|
356
|
-
|
|
357
|
-
throw new
|
|
376
|
+
logger.error(`Failed to update PR description: ${error.message}`);
|
|
377
|
+
throw new ProviderError(`Description update failed: ${error.message}`);
|
|
358
378
|
}
|
|
359
379
|
}
|
|
360
380
|
/**
|
|
361
381
|
* Show description preview for dry run
|
|
362
382
|
*/
|
|
363
383
|
showDescriptionPreview(enhancedDescription, analysisResult) {
|
|
364
|
-
console.log(
|
|
365
|
-
console.log(
|
|
366
|
-
console.log(
|
|
384
|
+
console.log("\n" + "═".repeat(80));
|
|
385
|
+
console.log("📝 ENHANCED PR DESCRIPTION PREVIEW");
|
|
386
|
+
console.log("═".repeat(80));
|
|
367
387
|
console.log(enhancedDescription);
|
|
368
|
-
console.log(
|
|
369
|
-
console.log(
|
|
370
|
-
console.log(`✅ Required sections completed: ${analysisResult.requiredSections.filter(s => s.present).length}/${analysisResult.requiredSections.length}`);
|
|
388
|
+
console.log("═".repeat(80));
|
|
389
|
+
console.log("\n📊 ENHANCEMENT SUMMARY:");
|
|
390
|
+
console.log(`✅ Required sections completed: ${analysisResult.requiredSections.filter((s) => s.present).length}/${analysisResult.requiredSections.length}`);
|
|
371
391
|
console.log(`📎 Preserved content: ${analysisResult.preservedContent.media.length} media items, ${analysisResult.preservedContent.files.length} files`);
|
|
372
392
|
console.log(`📏 Enhanced description length: ${enhancedDescription.length} characters`);
|
|
373
393
|
if (analysisResult.gaps.length > 0) {
|
|
374
|
-
console.log(`🔍 Content gaps addressed: ${analysisResult.gaps.join(
|
|
394
|
+
console.log(`🔍 Content gaps addressed: ${analysisResult.gaps.join(", ")}`);
|
|
375
395
|
}
|
|
376
396
|
}
|
|
377
397
|
/**
|
|
@@ -383,28 +403,30 @@ Generate the enhanced description now, ensuring ALL preservation requirements ar
|
|
|
383
403
|
const enhancedSections = this.validateRequiredSections(enhancedDescription, analysisResult.requiredSections);
|
|
384
404
|
const sectionsAdded = enhancedSections
|
|
385
405
|
.filter((enhanced, i) => enhanced.present && !originalSections[i].present)
|
|
386
|
-
.map(s => s.name);
|
|
406
|
+
.map((s) => s.name);
|
|
387
407
|
const sectionsEnhanced = enhancedSections
|
|
388
|
-
.filter((enhanced, i) => enhanced.present &&
|
|
389
|
-
|
|
390
|
-
.
|
|
391
|
-
|
|
408
|
+
.filter((enhanced, i) => enhanced.present &&
|
|
409
|
+
originalSections[i].present &&
|
|
410
|
+
(enhanced.content?.length || 0) >
|
|
411
|
+
(originalSections[i].content?.length || 0) + 50)
|
|
412
|
+
.map((s) => s.name);
|
|
413
|
+
const completedSections = enhancedSections.filter((s) => s.present).length;
|
|
392
414
|
return {
|
|
393
|
-
originalDescription: originalDescription ||
|
|
415
|
+
originalDescription: originalDescription || "",
|
|
394
416
|
enhancedDescription,
|
|
395
417
|
sectionsAdded,
|
|
396
418
|
sectionsEnhanced,
|
|
397
419
|
preservedItems: {
|
|
398
420
|
media: analysisResult.preservedContent.media.length,
|
|
399
421
|
files: analysisResult.preservedContent.files.length,
|
|
400
|
-
links: analysisResult.preservedContent.links.length
|
|
422
|
+
links: analysisResult.preservedContent.links.length,
|
|
401
423
|
},
|
|
402
424
|
statistics: {
|
|
403
425
|
originalLength: originalDescription?.length || 0,
|
|
404
426
|
enhancedLength: enhancedDescription.length,
|
|
405
427
|
completedSections,
|
|
406
|
-
totalSections: analysisResult.requiredSections.length
|
|
407
|
-
}
|
|
428
|
+
totalSections: analysisResult.requiredSections.length,
|
|
429
|
+
},
|
|
408
430
|
};
|
|
409
431
|
}
|
|
410
432
|
/**
|
|
@@ -413,12 +435,11 @@ Generate the enhanced description now, ensuring ALL preservation requirements ar
|
|
|
413
435
|
getStats() {
|
|
414
436
|
return {
|
|
415
437
|
defaultSections: this.defaultRequiredSections.length,
|
|
416
|
-
aiProvider: this.aiConfig.provider
|
|
438
|
+
aiProvider: this.aiConfig.provider,
|
|
417
439
|
};
|
|
418
440
|
}
|
|
419
441
|
}
|
|
420
|
-
|
|
421
|
-
function createDescriptionEnhancer(bitbucketProvider, aiConfig) {
|
|
442
|
+
export function createDescriptionEnhancer(bitbucketProvider, aiConfig) {
|
|
422
443
|
return new DescriptionEnhancer(bitbucketProvider, aiConfig);
|
|
423
444
|
}
|
|
424
445
|
//# sourceMappingURL=DescriptionEnhancer.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Yama - Main package exports
|
|
3
3
|
* Provides both programmatic API and CLI access
|
|
4
4
|
*/
|
|
5
|
-
export { Guardian, createGuardian, guardian } from
|
|
6
|
-
export { ContextGatherer, createContextGatherer } from
|
|
7
|
-
export type { UnifiedContext, ProjectContext, DiffStrategy } from
|
|
8
|
-
export { BitbucketProvider, createBitbucketProvider } from
|
|
9
|
-
export { CodeReviewer, createCodeReviewer } from
|
|
10
|
-
export { DescriptionEnhancer, createDescriptionEnhancer } from
|
|
11
|
-
export { Logger, createLogger, logger } from
|
|
12
|
-
export { Cache, createCache, cache } from
|
|
13
|
-
export { ConfigManager, createConfigManager, configManager } from
|
|
14
|
-
export * from
|
|
15
|
-
export { main as cli } from
|
|
5
|
+
export { Guardian, createGuardian, guardian } from "./core/Guardian.js";
|
|
6
|
+
export { ContextGatherer, createContextGatherer } from "./core/ContextGatherer.js";
|
|
7
|
+
export type { UnifiedContext, ProjectContext, DiffStrategy, } from "./core/ContextGatherer.js";
|
|
8
|
+
export { BitbucketProvider, createBitbucketProvider, } from "./core/providers/BitbucketProvider.js";
|
|
9
|
+
export { CodeReviewer, createCodeReviewer } from "./features/CodeReviewer.js";
|
|
10
|
+
export { DescriptionEnhancer, createDescriptionEnhancer, } from "./features/DescriptionEnhancer.js";
|
|
11
|
+
export { Logger, createLogger, logger } from "./utils/Logger.js";
|
|
12
|
+
export { Cache, createCache, cache } from "./utils/Cache.js";
|
|
13
|
+
export { ConfigManager, createConfigManager, configManager, } from "./utils/ConfigManager.js";
|
|
14
|
+
export * from "./types/index.js";
|
|
15
|
+
export { main as cli } from "./cli/index.js";
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,60 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Yama - Main package exports
|
|
4
3
|
* Provides both programmatic API and CLI access
|
|
5
4
|
*/
|
|
6
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
-
if (k2 === undefined) k2 = k;
|
|
8
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
-
}
|
|
12
|
-
Object.defineProperty(o, k2, desc);
|
|
13
|
-
}) : (function(o, m, k, k2) {
|
|
14
|
-
if (k2 === undefined) k2 = k;
|
|
15
|
-
o[k2] = m[k];
|
|
16
|
-
}));
|
|
17
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
-
};
|
|
20
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.cli = exports.configManager = exports.createConfigManager = exports.ConfigManager = exports.cache = exports.createCache = exports.Cache = exports.logger = exports.createLogger = exports.Logger = exports.createDescriptionEnhancer = exports.DescriptionEnhancer = exports.createCodeReviewer = exports.CodeReviewer = exports.createBitbucketProvider = exports.BitbucketProvider = exports.createContextGatherer = exports.ContextGatherer = exports.guardian = exports.createGuardian = exports.Guardian = void 0;
|
|
22
5
|
// Core classes
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(exports, "createGuardian", { enumerable: true, get: function () { return Guardian_1.createGuardian; } });
|
|
26
|
-
Object.defineProperty(exports, "guardian", { enumerable: true, get: function () { return Guardian_1.guardian; } });
|
|
27
|
-
var ContextGatherer_1 = require("./core/ContextGatherer");
|
|
28
|
-
Object.defineProperty(exports, "ContextGatherer", { enumerable: true, get: function () { return ContextGatherer_1.ContextGatherer; } });
|
|
29
|
-
Object.defineProperty(exports, "createContextGatherer", { enumerable: true, get: function () { return ContextGatherer_1.createContextGatherer; } });
|
|
6
|
+
export { Guardian, createGuardian, guardian } from "./core/Guardian.js";
|
|
7
|
+
export { ContextGatherer, createContextGatherer } from "./core/ContextGatherer.js";
|
|
30
8
|
// Providers
|
|
31
|
-
|
|
32
|
-
Object.defineProperty(exports, "BitbucketProvider", { enumerable: true, get: function () { return BitbucketProvider_1.BitbucketProvider; } });
|
|
33
|
-
Object.defineProperty(exports, "createBitbucketProvider", { enumerable: true, get: function () { return BitbucketProvider_1.createBitbucketProvider; } });
|
|
9
|
+
export { BitbucketProvider, createBitbucketProvider, } from "./core/providers/BitbucketProvider.js";
|
|
34
10
|
// Features
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Object.defineProperty(exports, "createCodeReviewer", { enumerable: true, get: function () { return CodeReviewer_1.createCodeReviewer; } });
|
|
38
|
-
var DescriptionEnhancer_1 = require("./features/DescriptionEnhancer");
|
|
39
|
-
Object.defineProperty(exports, "DescriptionEnhancer", { enumerable: true, get: function () { return DescriptionEnhancer_1.DescriptionEnhancer; } });
|
|
40
|
-
Object.defineProperty(exports, "createDescriptionEnhancer", { enumerable: true, get: function () { return DescriptionEnhancer_1.createDescriptionEnhancer; } });
|
|
11
|
+
export { CodeReviewer, createCodeReviewer } from "./features/CodeReviewer.js";
|
|
12
|
+
export { DescriptionEnhancer, createDescriptionEnhancer, } from "./features/DescriptionEnhancer.js";
|
|
41
13
|
// Utilities
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return Logger_1.logger; } });
|
|
46
|
-
var Cache_1 = require("./utils/Cache");
|
|
47
|
-
Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return Cache_1.Cache; } });
|
|
48
|
-
Object.defineProperty(exports, "createCache", { enumerable: true, get: function () { return Cache_1.createCache; } });
|
|
49
|
-
Object.defineProperty(exports, "cache", { enumerable: true, get: function () { return Cache_1.cache; } });
|
|
50
|
-
var ConfigManager_1 = require("./utils/ConfigManager");
|
|
51
|
-
Object.defineProperty(exports, "ConfigManager", { enumerable: true, get: function () { return ConfigManager_1.ConfigManager; } });
|
|
52
|
-
Object.defineProperty(exports, "createConfigManager", { enumerable: true, get: function () { return ConfigManager_1.createConfigManager; } });
|
|
53
|
-
Object.defineProperty(exports, "configManager", { enumerable: true, get: function () { return ConfigManager_1.configManager; } });
|
|
14
|
+
export { Logger, createLogger, logger } from "./utils/Logger.js";
|
|
15
|
+
export { Cache, createCache, cache } from "./utils/Cache.js";
|
|
16
|
+
export { ConfigManager, createConfigManager, configManager, } from "./utils/ConfigManager.js";
|
|
54
17
|
// Types
|
|
55
|
-
|
|
18
|
+
export * from "./types/index.js";
|
|
56
19
|
// CLI
|
|
57
|
-
|
|
58
|
-
Object.defineProperty(exports, "cli", { enumerable: true, get: function () { return index_1.main; } });
|
|
20
|
+
export { main as cli } from "./cli/index.js";
|
|
59
21
|
// Note: Use named import { Guardian } from '@juspay/yama' instead
|
|
60
22
|
//# sourceMappingURL=index.js.map
|