@gaunt-sloth/review 0.0.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/README.md +31 -0
- package/cli.js +63 -0
- package/dist/commands/commandUtils.d.ts +33 -0
- package/dist/commands/commandUtils.js +59 -0
- package/dist/commands/commandUtils.js.map +1 -0
- package/dist/config.d.ts +1 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/GthAgentRunner.d.ts +1 -0
- package/dist/core/GthAgentRunner.js +2 -0
- package/dist/core/GthAgentRunner.js.map +1 -0
- package/dist/core/types.d.ts +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/helpers/jira/jiraClient.d.ts +11 -0
- package/dist/helpers/jira/jiraClient.js +83 -0
- package/dist/helpers/jira/jiraClient.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/middleware/reviewRateMiddleware.d.ts +38 -0
- package/dist/middleware/reviewRateMiddleware.js +103 -0
- package/dist/middleware/reviewRateMiddleware.js.map +1 -0
- package/dist/modules/questionAnsweringModule.d.ts +9 -0
- package/dist/modules/questionAnsweringModule.js +49 -0
- package/dist/modules/questionAnsweringModule.js.map +1 -0
- package/dist/modules/reviewModule.d.ts +3 -0
- package/dist/modules/reviewModule.js +87 -0
- package/dist/modules/reviewModule.js.map +1 -0
- package/dist/modules/types.d.ts +18 -0
- package/dist/modules/types.js +2 -0
- package/dist/modules/types.js.map +1 -0
- package/dist/sources/fileSource.d.ts +8 -0
- package/dist/sources/fileSource.js +20 -0
- package/dist/sources/fileSource.js.map +1 -0
- package/dist/sources/ghIssueSource.d.ts +8 -0
- package/dist/sources/ghIssueSource.js +34 -0
- package/dist/sources/ghIssueSource.js.map +1 -0
- package/dist/sources/ghPrDiffSource.d.ts +8 -0
- package/dist/sources/ghPrDiffSource.js +29 -0
- package/dist/sources/ghPrDiffSource.js.map +1 -0
- package/dist/sources/jiraIssueLegacySource.d.ts +8 -0
- package/dist/sources/jiraIssueLegacySource.js +74 -0
- package/dist/sources/jiraIssueLegacySource.js.map +1 -0
- package/dist/sources/jiraIssueSource.d.ts +11 -0
- package/dist/sources/jiraIssueSource.js +62 -0
- package/dist/sources/jiraIssueSource.js.map +1 -0
- package/dist/sources/textSource.d.ts +8 -0
- package/dist/sources/textSource.js +10 -0
- package/dist/sources/textSource.js.map +1 -0
- package/dist/sources/types.d.ts +33 -0
- package/dist/sources/types.js +2 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/state/artifactStore.d.ts +1 -0
- package/dist/state/artifactStore.js +2 -0
- package/dist/state/artifactStore.js.map +1 -0
- package/dist/utils/ProgressIndicator.d.ts +1 -0
- package/dist/utils/ProgressIndicator.js +2 -0
- package/dist/utils/ProgressIndicator.js.map +1 -0
- package/dist/utils/consoleUtils.d.ts +1 -0
- package/dist/utils/consoleUtils.js +2 -0
- package/dist/utils/consoleUtils.js.map +1 -0
- package/dist/utils/debugUtils.d.ts +1 -0
- package/dist/utils/debugUtils.js +2 -0
- package/dist/utils/debugUtils.js.map +1 -0
- package/dist/utils/fileUtils.d.ts +7 -0
- package/dist/utils/fileUtils.js +20 -0
- package/dist/utils/fileUtils.js.map +1 -0
- package/dist/utils/llmUtils.d.ts +1 -0
- package/dist/utils/llmUtils.js +2 -0
- package/dist/utils/llmUtils.js.map +1 -0
- package/dist/utils/stringUtils.d.ts +1 -0
- package/dist/utils/stringUtils.js +2 -0
- package/dist/utils/stringUtils.js.map +1 -0
- package/dist/utils/systemUtils.d.ts +1 -0
- package/dist/utils/systemUtils.js +2 -0
- package/dist/utils/systemUtils.js.map +1 -0
- package/package.json +38 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { defaultStatusCallback, displayDebug, displayError, displayInfo, displaySuccess, displayWarning, flushSessionLog, initSessionLogging, stopSessionLogging, } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
2
|
+
import { getCommandOutputFilePath } from '#src/utils/fileUtils.js';
|
|
3
|
+
import { HumanMessage, SystemMessage } from '@langchain/core/messages';
|
|
4
|
+
import { GthAgentRunner } from '@gaunt-sloth/core/core/GthAgentRunner.js';
|
|
5
|
+
import { MemorySaver } from '@langchain/langgraph';
|
|
6
|
+
import { ProgressIndicator } from '@gaunt-sloth/core/utils/ProgressIndicator.js';
|
|
7
|
+
import { createReviewRateMiddleware, REVIEW_RATE_ARTIFACT_KEY, } from '#src/middleware/reviewRateMiddleware.js';
|
|
8
|
+
import { deleteArtifact, getArtifact } from '@gaunt-sloth/core/state/artifactStore.js';
|
|
9
|
+
import { setExitCode } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
10
|
+
export async function review(source, preamble, diff, config, command = 'review', resolvers) {
|
|
11
|
+
const progressIndicator = config.streamOutput ? undefined : new ProgressIndicator('Reviewing.');
|
|
12
|
+
const messages = [new SystemMessage(preamble), new HumanMessage(diff)];
|
|
13
|
+
// Prepare logging path (if enabled by config)
|
|
14
|
+
const filePath = getCommandOutputFilePath(config, source);
|
|
15
|
+
if (filePath) {
|
|
16
|
+
initSessionLogging(filePath, config.streamSessionInferenceLog);
|
|
17
|
+
}
|
|
18
|
+
const rateConfig = config.commands?.[command]?.rating;
|
|
19
|
+
if (rateConfig && rateConfig.enabled !== false) {
|
|
20
|
+
const confMiddleware = config.middleware || [];
|
|
21
|
+
const middlewareWithoutReviewRate = confMiddleware.filter((mw) => {
|
|
22
|
+
return !(typeof mw === 'object' &&
|
|
23
|
+
mw !== null &&
|
|
24
|
+
'name' in mw &&
|
|
25
|
+
mw.name === 'review-rate');
|
|
26
|
+
});
|
|
27
|
+
// Resolve review-rate middleware directly rather than going through the registry
|
|
28
|
+
const reviewRateMiddleware = await createReviewRateMiddleware(rateConfig, config);
|
|
29
|
+
config.middleware = [...middlewareWithoutReviewRate, reviewRateMiddleware];
|
|
30
|
+
}
|
|
31
|
+
const runner = new GthAgentRunner(defaultStatusCallback, resolvers);
|
|
32
|
+
try {
|
|
33
|
+
await runner.init(command, config, new MemorySaver());
|
|
34
|
+
await runner.processMessages(messages);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
displayDebug(error instanceof Error ? error : String(error));
|
|
38
|
+
displayError('Failed to run review with agent.');
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
await runner.cleanup();
|
|
42
|
+
}
|
|
43
|
+
progressIndicator?.stop();
|
|
44
|
+
handleRatingResult(rateConfig, command);
|
|
45
|
+
// Close the file AFTER rating is written
|
|
46
|
+
if (filePath) {
|
|
47
|
+
try {
|
|
48
|
+
flushSessionLog();
|
|
49
|
+
stopSessionLogging();
|
|
50
|
+
displaySuccess(`\n\nThis report can be found in ${filePath}`);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
displayDebug(error instanceof Error ? error : String(error));
|
|
54
|
+
displayError(`Failed to write review to file: ${filePath}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
deleteArtifact(REVIEW_RATE_ARTIFACT_KEY);
|
|
58
|
+
}
|
|
59
|
+
function handleRatingResult(rateConfig, command) {
|
|
60
|
+
if (!rateConfig || rateConfig.enabled === false) {
|
|
61
|
+
// No rating enabled - no need to handle the result
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const rating = getArtifact(REVIEW_RATE_ARTIFACT_KEY);
|
|
65
|
+
if (!rating) {
|
|
66
|
+
displayWarning(`Rating middleware did not return a score for ${command} command.`);
|
|
67
|
+
setExitCode(1); // Build should fail if rating is enabled, but no rating artifact is present
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const threshold = rateConfig.passThreshold ?? rating.passThreshold;
|
|
71
|
+
const maxRating = rateConfig.maxRating ?? rating.maxRating;
|
|
72
|
+
const verdictText = `${rating.rate}/${maxRating} (threshold: ${threshold})`;
|
|
73
|
+
displayInfo('\nREVIEW RATING');
|
|
74
|
+
if (rating.rate >= threshold) {
|
|
75
|
+
displaySuccess(`PASS ${verdictText}`);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
displayError(`FAIL ${verdictText}`);
|
|
79
|
+
if (rateConfig.errorOnReviewFail ?? true) {
|
|
80
|
+
setExitCode(1);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (rating.comment) {
|
|
84
|
+
displayInfo(rating.comment);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=reviewModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewModule.js","sourceRoot":"","sources":["../../src/modules/reviewModule.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AACjF,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GAEzB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAGrE,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,MAAc,EACd,QAAgB,EAChB,IAAY,EACZ,MAAiB,EACjB,UAA2B,QAAQ,EACnC,SAA0B;IAE1B,MAAM,iBAAiB,GAAG,MAAM,CAAC,Y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AS,GAAG,UAAU,CAAC,aAAa,IAAI,MAAM,CAAC,aAAa,CAAC;IACnE,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,IAAI,MAAM,CAAC,SAAS,CAAC;IAC3D,MAAM,WAAW,GAAG,GAAG,MAAM,CAAC,IAAI,IAAI,SAAS,gBAAgB,SAAS,GAAG,CAAC;IAC5E,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAE/B,IAAI,MAAM,CAAC,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,cAAc,CAAC,QAAQ,WAAW,EAAE,CAAC,CAAC;IACxC,CAAC;SAAM,CAAC;QACN,YAAY,CAAC,QAAQ,WAAW,EAAE,CAAC,CAAC;QACpC,IAAI,UAAU,CAAC,iBAAiB,IAAI,IAAI,EAAE,CAAC;YACzC,WAAW,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BaseMessage } from '@langchain/core/messages';
|
|
2
|
+
export type Message = BaseMessage;
|
|
3
|
+
export interface State {
|
|
4
|
+
messages: Message[];
|
|
5
|
+
}
|
|
6
|
+
export interface ProgressCallback {
|
|
7
|
+
(): void;
|
|
8
|
+
}
|
|
9
|
+
export interface ReviewOptions {
|
|
10
|
+
source: string;
|
|
11
|
+
preamble: string;
|
|
12
|
+
diff: string;
|
|
13
|
+
}
|
|
14
|
+
export interface QuestionOptions {
|
|
15
|
+
source: string;
|
|
16
|
+
preamble: string;
|
|
17
|
+
content: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/modules/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProviderConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reads the text file from current dir
|
|
4
|
+
* @param _ config (unused in this source)
|
|
5
|
+
* @param fileName
|
|
6
|
+
* @returns file contents
|
|
7
|
+
*/
|
|
8
|
+
export declare function get(_: ProviderConfig | null, fileName: string | undefined): Promise<string | null>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { resolve } from 'node:path';
|
|
2
|
+
import { display } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
3
|
+
import { getCurrentWorkDir } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
4
|
+
import { readFileSyncWithMessages } from '#src/utils/fileUtils.js';
|
|
5
|
+
/**
|
|
6
|
+
* Reads the text file from current dir
|
|
7
|
+
* @param _ config (unused in this source)
|
|
8
|
+
* @param fileName
|
|
9
|
+
* @returns file contents
|
|
10
|
+
*/
|
|
11
|
+
export async function get(_, fileName) {
|
|
12
|
+
if (!fileName) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const currentDir = getCurrentWorkDir();
|
|
16
|
+
const filePath = resolve(currentDir, fileName);
|
|
17
|
+
display(`Reading file ${fileName}...`);
|
|
18
|
+
return readFileSyncWithMessages(filePath);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=fileSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileSource.js","sourceRoot":"","sources":["../../src/sources/fileSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,yCAAyC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAG3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,CAAwB,EACxB,QAA4B;IAE5B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,UAAU,GAAG,iBAAiB,EAAE,CAAC;IACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC/C,OAAO,CAAC,gBAAgB,QAAQ,KAAK,CAAC,CAAC;IACvC,OAAO,wBAAwB,CAAC,QAAQ,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProviderConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Gets GitHub issue using GitHub CLI
|
|
4
|
+
* @param _ config (unused in this source)
|
|
5
|
+
* @param issueId GitHub issue number
|
|
6
|
+
* @returns GitHub issue content or null if not found
|
|
7
|
+
*/
|
|
8
|
+
export declare function get(_: ProviderConfig | null, issueId: string | undefined): Promise<string | null>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { displayWarning } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
2
|
+
import { execAsync } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
3
|
+
import { ProgressIndicator } from '@gaunt-sloth/core/utils/ProgressIndicator.js';
|
|
4
|
+
/**
|
|
5
|
+
* Gets GitHub issue using GitHub CLI
|
|
6
|
+
* @param _ config (unused in this source)
|
|
7
|
+
* @param issueId GitHub issue number
|
|
8
|
+
* @returns GitHub issue content or null if not found
|
|
9
|
+
*/
|
|
10
|
+
export async function get(_, issueId) {
|
|
11
|
+
if (!issueId) {
|
|
12
|
+
displayWarning('No GitHub issue number provided');
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
// Use the GitHub CLI to fetch issue details
|
|
17
|
+
const progress = new ProgressIndicator(`Fetching GitHub issue #${issueId}`);
|
|
18
|
+
const issueContent = await execAsync(`gh issue view ${issueId}`);
|
|
19
|
+
progress.stop();
|
|
20
|
+
if (!issueContent) {
|
|
21
|
+
displayWarning(`No content found for GitHub issue #${issueId}`);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return `GitHub Issue: #${issueId}\n\n${issueContent}`;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
displayWarning(`
|
|
28
|
+
Failed to get GitHub issue #${issueId}: ${error instanceof Error ? error.message : String(error)}
|
|
29
|
+
Consider checking if gh cli (https://cli.github.com/) is installed and authenticated.
|
|
30
|
+
`);
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=ghIssueSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ghIssueSource.js","sourceRoot":"","sources":["../../src/sources/ghIssueSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,CAAwB,EACxB,OAA2B;IAE3B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,cAAc,CAAC,iCAAiC,CAAC,CAAC;QAClD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,4CAA4C;QAC5C,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAC;QAC5E,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;QACjE,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEhB,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,cAAc,CAAC,sCAAsC,OAAO,EAAE,CAAC,CAAC;YAChE,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,kBAAkB,OAAO,OAAO,YAAY,EAAE,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,cAAc,CAAC;8BACW,OAAO,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;;KAE3F,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProviderConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Gets PR diff using GitHub CLI
|
|
4
|
+
* @param _ config (unused in this source)
|
|
5
|
+
* @param prId GitHub PR number
|
|
6
|
+
* @returns GitHub PR diff content or null if not found
|
|
7
|
+
*/
|
|
8
|
+
export declare function get(_: ProviderConfig | null, prId: string | undefined): Promise<string | null>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { execAsync } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
2
|
+
import { ProgressIndicator } from '@gaunt-sloth/core/utils/ProgressIndicator.js';
|
|
3
|
+
/**
|
|
4
|
+
* Gets PR diff using GitHub CLI
|
|
5
|
+
* @param _ config (unused in this source)
|
|
6
|
+
* @param prId GitHub PR number
|
|
7
|
+
* @returns GitHub PR diff content or null if not found
|
|
8
|
+
*/
|
|
9
|
+
export async function get(_, prId) {
|
|
10
|
+
if (!prId) {
|
|
11
|
+
throw new Error('No GitHub PR number provided');
|
|
12
|
+
}
|
|
13
|
+
// Use the GitHub CLI to fetch PR diff
|
|
14
|
+
const progress = new ProgressIndicator(`Fetching GitHub PR #${prId} diff`);
|
|
15
|
+
try {
|
|
16
|
+
const prDiffContent = await execAsync(`gh pr diff ${prId}`);
|
|
17
|
+
progress.stop();
|
|
18
|
+
if (!prDiffContent) {
|
|
19
|
+
throw new Error(`No diff content found for GitHub PR #${prId}`);
|
|
20
|
+
}
|
|
21
|
+
return `GitHub PR Diff: #${prId}\n\n${prDiffContent}`;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
progress.stop();
|
|
25
|
+
throw new Error(`Failed to get GitHub PR diff #${prId}: ${error instanceof Error ? error.message : String(error)}
|
|
26
|
+
Consider checking if gh cli (https://cli.github.com/) is installed and authenticated.`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=ghPrDiffSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ghPrDiffSource.js","sourceRoot":"","sources":["../../src/sources/ghPrDiffSource.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,CAAwB,EACxB,IAAwB;IAExB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,sCAAsC;IACtC,MAAM,QAAQ,GAAG,IAAI,iBAAiB,CAAC,uBAAuB,IAAI,OAAO,CAAC,CAAC;IAC3E,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,MAAM,SAAS,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;QAC5D,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEhB,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,wCAAwC,IAAI,EAAE,CAAC,CAAC;QAClE,CAAC;QAED,OAAO,oBAAoB,IAAI,OAAO,aAAa,EAAE,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,IAAI,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;sFAC9B,CAAC,CAAC;IACtF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { JiraLegacyConfig } from '#src/sources/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Gets Jira issue using Atlassian REST API v2 with unscoped API token (aka Legacy Token)
|
|
4
|
+
* @param config Jira configuration
|
|
5
|
+
* @param issueId Jira issue ID
|
|
6
|
+
* @returns Jira issue content
|
|
7
|
+
*/
|
|
8
|
+
export declare function get(config: Partial<JiraLegacyConfig>, issueId: string | undefined): Promise<string | null>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { display, displayError, displayWarning } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
2
|
+
import { env } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Gets Jira issue using Atlassian REST API v2 with unscoped API token (aka Legacy Token)
|
|
5
|
+
* @param config Jira configuration
|
|
6
|
+
* @param issueId Jira issue ID
|
|
7
|
+
* @returns Jira issue content
|
|
8
|
+
*/
|
|
9
|
+
export async function get(config, issueId) {
|
|
10
|
+
if (!config) {
|
|
11
|
+
displayWarning('No Jira config provided');
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
if (!issueId) {
|
|
15
|
+
displayWarning('No issue ID provided');
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (!config.baseUrl) {
|
|
19
|
+
displayWarning('No Jira base URL provided');
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
// Get username from environment variable or config
|
|
23
|
+
const username = env.JIRA_USERNAME || config.username;
|
|
24
|
+
if (!username) {
|
|
25
|
+
throw new Error('Missing JIRA username. The username can be defined as JIRA_USERNAME environment variable or as "username" in config.');
|
|
26
|
+
}
|
|
27
|
+
// Get token from environment variable or config
|
|
28
|
+
const token = env.JIRA_LEGACY_API_TOKEN || config.token;
|
|
29
|
+
if (!token) {
|
|
30
|
+
throw new Error('Missing JIRA Legacy API token. The legacy token can be defined as JIRA_LEGACY_API_TOKEN environment variable or as "token" in config.');
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
const issue = await getJiraIssue({
|
|
34
|
+
...config,
|
|
35
|
+
username,
|
|
36
|
+
token,
|
|
37
|
+
}, issueId);
|
|
38
|
+
if (!issue) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
const summary = issue.fields.summary;
|
|
42
|
+
const description = issue.fields.description;
|
|
43
|
+
return `Jira Issue: ${issueId}\nSummary: ${summary}\n\nDescription:\n${description}`;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
displayError(`Failed to get Jira issue: ${error instanceof Error ? error.message : String(error)}`);
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Helper function to get Jira issue details
|
|
52
|
+
* @param config Jira configuration
|
|
53
|
+
* @param issueId Jira issue ID
|
|
54
|
+
* @returns Jira issue response
|
|
55
|
+
*/
|
|
56
|
+
async function getJiraIssue(config, issueId) {
|
|
57
|
+
const auth = Buffer.from(`${config.username}:${config.token}`).toString('base64');
|
|
58
|
+
const url = `${config.baseUrl}${issueId}`;
|
|
59
|
+
if (config.displayUrl) {
|
|
60
|
+
display(`Loading Jira issue ${config.displayUrl}${issueId}`);
|
|
61
|
+
}
|
|
62
|
+
display(`Retrieving jira from api ${url.replace(/^https?:\/\//, '')}`);
|
|
63
|
+
const response = await fetch(url, {
|
|
64
|
+
headers: {
|
|
65
|
+
Authorization: `Basic ${auth}`,
|
|
66
|
+
Accept: 'application/json',
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
throw new Error(`Failed to fetch Jira issue from ${url} with status: ${response.statusText}`);
|
|
71
|
+
}
|
|
72
|
+
return response.json();
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=jiraIssueLegacySource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jiraIssueLegacySource.js","sourceRoot":"","s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
|
|
1
|
+
import type { JiraConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Gets Jira issue using Atlassian REST API v3 with Personal Access Token
|
|
4
|
+
*
|
|
5
|
+
* TODO we need to figure out how would this work with public jira.
|
|
6
|
+
*
|
|
7
|
+
* @param config Jira configuration
|
|
8
|
+
* @param issueId Jira issue ID
|
|
9
|
+
* @returns Jira issue content
|
|
10
|
+
*/
|
|
11
|
+
export declare function get(config: Partial<JiraConfig> | null, issueId: string | undefined): Promise<string | null>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { display, displayError, displayWarning } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
2
|
+
import { getJiraCredentials, jiraRequest, } from '#src/helpers/jira/jiraClient.js';
|
|
3
|
+
/**
|
|
4
|
+
* Gets Jira issue using Atlassian REST API v3 with Personal Access Token
|
|
5
|
+
*
|
|
6
|
+
* TODO we need to figure out how would this work with public jira.
|
|
7
|
+
*
|
|
8
|
+
* @param config Jira configuration
|
|
9
|
+
* @param issueId Jira issue ID
|
|
10
|
+
* @returns Jira issue content
|
|
11
|
+
*/
|
|
12
|
+
export async function get(config, issueId) {
|
|
13
|
+
if (!config) {
|
|
14
|
+
displayWarning('No Jira config provided');
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (!issueId) {
|
|
18
|
+
displayWarning('No issue ID provided');
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const credentials = getJiraCredentials(config);
|
|
22
|
+
try {
|
|
23
|
+
const issue = await getJiraIssue(credentials, issueId);
|
|
24
|
+
if (!issue) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const summary = issue.fields.summary;
|
|
28
|
+
const description = issue.fields.description;
|
|
29
|
+
return `Jira Issue: ${issueId}\nSummary: ${summary}\n\nDescription:\n${description}`;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
displayError(`Failed to get Jira issue: ${error instanceof Error ? error.message : String(error)}`);
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Helper function to get Jira issue details using Atlassian REST API v2.
|
|
38
|
+
*
|
|
39
|
+
* The feature was initially developed to use Atlassian REST API v3, which by
|
|
40
|
+
* default returns the ADF JSON format for description, which is not very useful for us.
|
|
41
|
+
*
|
|
42
|
+
* @param config Jira configuration
|
|
43
|
+
* @param jiraKey Jira issue ID
|
|
44
|
+
* @returns Jira issue response
|
|
45
|
+
*/
|
|
46
|
+
async function getJiraIssue(credentials, jiraKey) {
|
|
47
|
+
// Jira Cloud ID can be found by authenticated user at https://company.atlassian.net/_edge/tenant_info
|
|
48
|
+
// According to doc https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-get permissions to read this resource:
|
|
49
|
+
// https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-issues/#api-rest-api-2-issue-issueidorkey-get
|
|
50
|
+
// either Classic (RECOMMENDED) read:jira-work
|
|
51
|
+
// or Granular read:issue-meta:jira, read:issue-security-level:jira, read:issue.vote:jira, read:issue.changelog:jira,
|
|
52
|
+
// read:avatar:jira, read:issue:jira, read:status:jira, read:user:jira, read:field-configuration:jira
|
|
53
|
+
if (credentials.displayUrl) {
|
|
54
|
+
display(`Loading Jira issue ${credentials.displayUrl}${jiraKey}`);
|
|
55
|
+
}
|
|
56
|
+
// This filter will be necessary for V3: `&expand=renderedFields` to convert ADF to HTML
|
|
57
|
+
const filters = '?fields=summary,description'; // Limit JSON to summary and description
|
|
58
|
+
return jiraRequest(credentials, `/rest/api/2/issue/${jiraKey}${filters}`, {
|
|
59
|
+
method: 'GET',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=jiraIssueSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jiraIssueSource.js","sourceRoot":"","sources":["../../src/sources/jiraIssueSource.ts"],"names":[],"mapp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,IAAI,WAAW,CAAC,UAAU,EAAE,CAAC;QAC3B,OAAO,CAAC,sBAAsB,WAAW,CAAC,UAAU,GAAG,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,wFAAwF;IACxF,MAAM,OAAO,GAAG,6BAA6B,CAAC,CAAC,wCAAwC;IAEvF,OAAO,WAAW,CAAoB,WAAW,EAAE,qBAAqB,OAAO,GAAG,OAAO,EAAE,EAAE;QAC3F,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ProviderConfig } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the provided text as is
|
|
4
|
+
* @param _ config (unused in this source)
|
|
5
|
+
* @param text Text to return
|
|
6
|
+
* @returns The provided text
|
|
7
|
+
*/
|
|
8
|
+
export declare function get(_: ProviderConfig | null, text: string | undefined): Promise<string | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textSource.js","sourceRoot":"","sources":["../../src/sources/textSource.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,CAAwB,EACxB,IAAwB;IAExB,OAAO,IAAI,IAAI,IAAI,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ProviderConfig {
|
|
2
|
+
username?: string;
|
|
3
|
+
token?: string;
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}
|
|
7
|
+
export interface JiraLegacyConfig extends ProviderConfig {
|
|
8
|
+
username: string;
|
|
9
|
+
baseUrl: string;
|
|
10
|
+
displayUrl?: string;
|
|
11
|
+
token: string;
|
|
12
|
+
}
|
|
13
|
+
export interface JiraConfig extends ProviderConfig {
|
|
14
|
+
cloudId: string;
|
|
15
|
+
username?: string;
|
|
16
|
+
displayUrl?: string;
|
|
17
|
+
token?: string;
|
|
18
|
+
fullBase64Token?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Configuration for an A2A (Agent-to-Agent) protocol agent.
|
|
22
|
+
* @experimental A2A support is experimental and may change.
|
|
23
|
+
* @see {@link https://a2a-protocol.org/}
|
|
24
|
+
*/
|
|
25
|
+
export interface A2AConfig {
|
|
26
|
+
/** Unique identifier for the agent, used in tool naming */
|
|
27
|
+
agentId: string;
|
|
28
|
+
/** URL endpoint for the A2A agent */
|
|
29
|
+
agentUrl: string;
|
|
30
|
+
}
|
|
31
|
+
export interface Provider {
|
|
32
|
+
get: (config: ProviderConfig | null, id: string | undefined) => Promise<string | null>;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/sources/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@gaunt-sloth/core/state/artifactStore.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifactStore.js","sourceRoot":"","sources":["../../src/state/artifactStore.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@gaunt-sloth/core/utils/ProgressIndicator.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressIndicator.js","sourceRoot":"","sources":["../../src/utils/ProgressIndicator.ts"],"names":[],"mappings":"AAAA,cAAc,8CAA8C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consoleUtils.js","sourceRoot":"","sources":["../../src/utils/consoleUtils.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@gaunt-sloth/core/utils/debugUtils.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debugUtils.js","sourceRoot":"","sources":["../../src/utils/debugUtils.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from '@gaunt-sloth/core/utils/fileUtils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reads multiple files from the current directory and returns their contents
|
|
4
|
+
* @param fileNames - Array of file names to read
|
|
5
|
+
* @returns Combined content of all files with proper formatting, each file is wrapped in random block like <file-abvesde>
|
|
6
|
+
*/
|
|
7
|
+
export declare function readMultipleFilesFromProjectDir(fileNames: string | string[]): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from '@gaunt-sloth/core/utils/fileUtils.js';
|
|
2
|
+
import { readFileFromProjectDir } from '@gaunt-sloth/core/utils/fileUtils.js';
|
|
3
|
+
import { wrapContent } from '@gaunt-sloth/core/utils/llmUtils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Reads multiple files from the current directory and returns their contents
|
|
6
|
+
* @param fileNames - Array of file names to read
|
|
7
|
+
* @returns Combined content of all files with proper formatting, each file is wrapped in random block like <file-abvesde>
|
|
8
|
+
*/
|
|
9
|
+
export function readMultipleFilesFromProjectDir(fileNames) {
|
|
10
|
+
if (!Array.isArray(fileNames)) {
|
|
11
|
+
return wrapContent(readFileFromProjectDir(fileNames), 'file', `file ${fileNames}`, true);
|
|
12
|
+
}
|
|
13
|
+
return fileNames
|
|
14
|
+
.map((fileName) => {
|
|
15
|
+
const content = readFileFromProjectDir(fileName);
|
|
16
|
+
return `${wrapContent(content, 'file', `file ${fileName}`, true)}`;
|
|
17
|
+
})
|
|
18
|
+
.join('\n\n');
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=fileUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../../src/utils/fileUtils.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE;;;;GAIG;AACH,MAAM,UAAU,+BAA+B,CAAC,SAA4B;IAC1E,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC9B,OAAO,WAAW,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,SAAS,EAAE,EAAE,IAAI,CAAC,CAAC;IAC3F,CAAC;IAED,OAAO,SAAS;SACb,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QAChB,MAAM,OAAO,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAO,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,QAAQ,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;IACrE,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@gaunt-sloth/core/utils/llmUtils.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"llmUtils.js","sourceRoot":"","sources":["../../src/utils/llmUtils.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@gaunt-sloth/core/utils/stringUtils.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringUtils.js","sourceRoot":"","sources":["../../src/utils/stringUtils.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemUtils.js","sourceRoot":"","sources":["../../src/utils/systemUtils.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC"}
|