gaunt-sloth-assistant 1.5.4 → 1.5.5
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/.gsloth.pr-discovery.md +23 -0
- package/dist/commands/commandIntrospection.d.ts +1 -1
- package/dist/commands/commandIntrospection.js +10 -3
- package/dist/commands/commandIntrospection.js.map +1 -1
- package/dist/commands/getCommand.js +1 -1
- package/dist/commands/getCommand.js.map +1 -1
- package/dist/commands/prCommand.js +58 -13
- package/dist/commands/prCommand.js.map +1 -1
- package/dist/commands/prDiscovery.d.ts +54 -0
- package/dist/commands/prDiscovery.js +451 -0
- package/dist/commands/prDiscovery.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Change Requirements Discovery
|
|
2
|
+
|
|
3
|
+
You are preparing inputs for a pull request code review before the review agent runs.
|
|
4
|
+
|
|
5
|
+
Your goal is to gather exactly two pieces of information:
|
|
6
|
+
|
|
7
|
+
1. The pull request diff.
|
|
8
|
+
2. The requirements that should be used for the review.
|
|
9
|
+
|
|
10
|
+
Use the available tools to infer the current pull request and its requirements. Prefer deterministic sources over guesses:
|
|
11
|
+
|
|
12
|
+
- First, inspect the PR metadata/description. If it contains an explicit requirements link, use that link and do not search nearby issue numbers.
|
|
13
|
+
- Use `gh_pr` to retrieve GitHub PR metadata, including the title, branch names, URL, and description/body. If no PR number is known, call it without a PR number to retrieve the current branch PR.
|
|
14
|
+
- Use `gh_diff` to retrieve a GitHub PR diff; it stores the diff as the review diff automatically and returns a short preview. If no PR number is known, call it without a PR number to retrieve the current branch PR diff.
|
|
15
|
+
- Use `gh_issue` to retrieve GitHub issue descriptions only when the PR description, title, branch name, or another reliable source points to a GitHub issue. Pass the full issue URL when the issue lives in another repository.
|
|
16
|
+
- Use repository, shell, MCP, Jira, and other configured tools when available to find requirement documents or issue tracker items.
|
|
17
|
+
|
|
18
|
+
`gh_diff` already sets the diff for you; only call `set_diff` when you have assembled a better exact diff some other way.
|
|
19
|
+
When you have the best available requirements, call `set_requirements` with the complete requirements text exactly as they should constrain the review.
|
|
20
|
+
|
|
21
|
+
Do not invent requirements. Do not brute-force issue numbers. If no requirements can be found, call `set_requirements` with a concise statement explaining that no external requirements were found and what evidence was checked.
|
|
22
|
+
|
|
23
|
+
Finish with a short summary of what you set and where it came from.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GthConfig } from '@gaunt-sloth/core/config.js';
|
|
2
2
|
import { type ContentProviderType, type RequirementsProviderType } from '#src/commands/commandUtils.js';
|
|
3
|
-
export type PromptCommandType = 'ask' | 'review' | 'pr' | 'chat' | 'code';
|
|
3
|
+
export type PromptCommandType = 'ask' | 'review' | 'pr' | 'pr-discovery' | 'chat' | 'code';
|
|
4
4
|
export type ProviderCommandType = 'review' | 'pr';
|
|
5
5
|
export type ProviderInputType = 'content' | 'requirements';
|
|
6
6
|
export declare function getAskSystemPrompt(config: GthConfig): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getContentFromProvider, getRequirementsFromProvider, } from '#src/commands/commandUtils.js';
|
|
2
2
|
import { buildSystemMessages, readBackstory, readChatPrompt, readCodePrompt, readGuidelines, readReviewInstructions, readSystemPrompt, } from '@gaunt-sloth/core/utils/llmUtils.js';
|
|
3
|
+
import { readPrDiscoveryPrompt } from '#src/commands/prDiscovery.js';
|
|
3
4
|
export function getAskSystemPrompt(config) {
|
|
4
5
|
const parts = [readBackstory(config), readGuidelines(config)];
|
|
5
6
|
const systemPrompt = readSystemPrompt(config);
|
|
@@ -23,9 +24,15 @@ export function getCommandSystemPrompt(command, config) {
|
|
|
23
24
|
if (command === 'review' || command === 'pr') {
|
|
24
25
|
return getReviewSystemPrompt(config);
|
|
25
26
|
}
|
|
26
|
-
const modePrompt = command === '
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const modePrompt = command === 'pr-discovery'
|
|
28
|
+
? readPrDiscoveryPrompt(config)
|
|
29
|
+
: command === 'chat'
|
|
30
|
+
? readChatPrompt(config)
|
|
31
|
+
: readCodePrompt(config);
|
|
32
|
+
return flattenSystemMessageContent(config, modePrompt);
|
|
33
|
+
}
|
|
34
|
+
function flattenSystemMessageContent(config, modePrompt) {
|
|
35
|
+
const [systemMessage] = buildSystemMessages(config, modePrompt);
|
|
29
36
|
const content = systemMessage?.content;
|
|
30
37
|
if (typeof content === 'string') {
|
|
31
38
|
return content;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandIntrospection.js","sourceRoot":"","sources":["../../src/commands/commandIntrospection.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,2BAA2B,GAG5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"commandIntrospection.js","sourceRoot":"","sources":["../../src/commands/commandIntrospection.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,2BAA2B,GAG5B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAMrE,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,MAAM,KAAK,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9D,MAAM,YAAY,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAC9C,IAAI,YAAY,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC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CACP,CAAC;AACJ,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { initConfig } from '@gaunt-sloth/core/config.js';
|
|
|
2
2
|
import { getCommandProviderInput, getCommandSystemPrompt, } from '#src/commands/commandIntrospection.js';
|
|
3
3
|
import { display, displayError } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
4
4
|
import { setExitCode } from '@gaunt-sloth/core/utils/systemUtils.js';
|
|
5
|
-
const PROMPT_COMMANDS = ['ask', 'review', 'pr', 'chat', 'code'];
|
|
5
|
+
const PROMPT_COMMANDS = ['ask', 'review', 'pr', 'pr-discovery', 'chat', 'code'];
|
|
6
6
|
const PROVIDER_COMMANDS = ['review', 'pr'];
|
|
7
7
|
const INPUT_TYPES = ['content', 'requirements'];
|
|
8
8
|
export function getCommand(program, commandLineConfigOverrides) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCommand.js","sourceRoot":"","sources":["../../src/commands/getCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GAIvB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAErE,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"getCommand.js","sourceRoot":"","sources":["../../src/commands/getCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAA8B,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACrF,OAAO,EACL,uBAAuB,EACvB,sBAAsB,GAIvB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,WAAW,EAAE,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AAQ,CAAC,OAA8B,CAAC,EAAE,CAAC;gBAChE,MAAM,IAAI,KAAK,CAAC,wCAAwC,OAAO,GAAG,CAAC,CAAC;YACtE,CAAC;YACD,IAAI,CAAC,EAAE,EAAE,CAAC;gBACR,MAAM,IAAI,KAAK,CAAC,YAAY,OAAO,mBAAmB,CAAC,CAAC;YAC1D,CAAC;YAED,OAAO,CACL,MAAM,uBAAuB,CAC3B,OAA8B,EAC9B,OAA4B,EAC5B,EAAE,EACF,MAAM,CACP,CACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,YAAY,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACrE,WAAW,CAAC,CAAC,CAAC,CAAC;QACjB,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { getCommandProviderInput, getEffectiveContentProvider, getEffectiveRequi
|
|
|
5
5
|
import { REQUIREMENTS_PROVIDERS } from './commandUtils.js';
|
|
6
6
|
import jiraLogWork from '#src/helpers/jira/jiraLogWork.js';
|
|
7
7
|
import { wrapContent } from '@gaunt-sloth/core/utils/llmUtils.js';
|
|
8
|
+
import { runPrDiscovery } from '#src/commands/prDiscovery.js';
|
|
8
9
|
import { readMultipleFilesFromProjectDir } from '@gaunt-sloth/review/utils/fileUtils.js';
|
|
9
10
|
export function prCommand(program, commandLineConfigOverrides) {
|
|
10
11
|
program
|
|
@@ -12,7 +13,7 @@ export function prCommand(program, commandLineConfigOverrides) {
|
|
|
12
13
|
.description('Review provided Pull Request in current directory. ' +
|
|
13
14
|
'This command is similar to `review`, but default content provider is `github`. ' +
|
|
14
15
|
'(assuming that GitHub CLI is installed and authenticated for current project')
|
|
15
|
-
.argument('
|
|
16
|
+
.argument('[prId]', "Pull request ID to review. Omit both prId and requirementsId to discover the change requirements from the current branch's PR.")
|
|
16
17
|
.argument('[requirementsId]', 'Optional requirements ID argument to retrieve requirements with requirements provider')
|
|
17
18
|
.addOption(new Option('-p, --requirements-provider <requirementsProvider>', 'Requirements provider for this review.').choices(Object.keys(REQUIREMENTS_PROVIDERS)))
|
|
18
19
|
.option('-f, --file [files...]', 'Input files. Content of these files will be added BEFORE the diff, but after requirements')
|
|
@@ -26,20 +27,64 @@ export function prCommand(program, commandLineConfigOverrides) {
|
|
|
26
27
|
if (options.file) {
|
|
27
28
|
content.push(readMultipleFilesFromProjectDir(options.file));
|
|
28
29
|
}
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
content.push(await getCommandProviderInput('pr', 'content', prId, config, contentProvider));
|
|
37
|
-
}
|
|
38
|
-
catch (error) {
|
|
39
|
-
displayError(error instanceof Error ? error.message : String(error));
|
|
30
|
+
const isDiscovery = !prId && !requirementsId;
|
|
31
|
+
const looksLikeRequirementsOnlyMode = contentProvider === 'github' && Boolean(prId) && !requirementsId && !/^\d+$/.test(prId);
|
|
32
|
+
if (looksLikeRequirementsOnlyMode) {
|
|
33
|
+
displayError(`Unsupported PR command arguments: "${prId}" was provided as the pull request ID. ` +
|
|
34
|
+
'`gth pr <requirementsId>` requirements-only mode is not supported. ' +
|
|
35
|
+
'Use `gth pr` with no arguments to discover change requirements automatically, or provide both a numeric PR ID and requirements ID: `gth pr <prId> <requirementsId>`.');
|
|
40
36
|
setExitCode(1);
|
|
41
37
|
return;
|
|
42
38
|
}
|
|
39
|
+
if (isDiscovery) {
|
|
40
|
+
if (config.commands?.pr?.discovery?.enabled === false) {
|
|
41
|
+
displayError('Change requirements discovery is disabled. Provide a pull request ID to run `gth pr`.');
|
|
42
|
+
setExitCode(1);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const discoveryResult = await runPrDiscovery(config);
|
|
47
|
+
if (discoveryResult.requirements) {
|
|
48
|
+
content.push(wrapContent(discoveryResult.requirements, 'discovered-requirements', 'requirements'));
|
|
49
|
+
}
|
|
50
|
+
if (!discoveryResult.diff) {
|
|
51
|
+
displayError('Change requirements discovery did not produce a diff. Cannot continue with review.');
|
|
52
|
+
setExitCode(1);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
content.push(wrapContent(discoveryResult.diff, 'discovered-diff', 'GitHub diff'));
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
displayError(error instanceof Error ? error.message : String(error));
|
|
59
|
+
setExitCode(1);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
// Handle requirements
|
|
65
|
+
const requirements = await getCommandProviderInput('pr', 'requirements', requirementsId, config, requirementsProvider);
|
|
66
|
+
if (requirements) {
|
|
67
|
+
content.push(requirements);
|
|
68
|
+
}
|
|
69
|
+
// Get PR diff using the provider
|
|
70
|
+
try {
|
|
71
|
+
const prContent = await getCommandProviderInput('pr', 'content', prId, config, contentProvider);
|
|
72
|
+
// A provider may resolve to an empty result instead of throwing - e.g. ghPrDiffSource
|
|
73
|
+
// returns null (with a warning) for an invalid PR number. Without this guard the review
|
|
74
|
+
// would silently proceed against no diff; fail loudly as the throwing path used to.
|
|
75
|
+
if (!prContent) {
|
|
76
|
+
displayError(`Could not retrieve PR content for "${prId}". Cannot continue with review.`);
|
|
77
|
+
setExitCode(1);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
content.push(prContent);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
displayError(error instanceof Error ? error.message : String(error));
|
|
84
|
+
setExitCode(1);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
43
88
|
if (options.message) {
|
|
44
89
|
content.push(wrapContent(options.message, 'message', 'user message'));
|
|
45
90
|
}
|
|
@@ -47,7 +92,7 @@ export function prCommand(program, commandLineConfigOverrides) {
|
|
|
47
92
|
const { createResolvers } = await import('@gaunt-sloth/api/resolvers.js');
|
|
48
93
|
// TODO consider including requirements id
|
|
49
94
|
// TODO sanitize prId
|
|
50
|
-
await review(`PR-${prId}
|
|
95
|
+
await review(prId ? `PR-${prId}` : 'PR-discovery', getReviewSystemPrompt(config), content.join('\n'), config, 'pr', createResolvers());
|
|
51
96
|
if (requirementsId &&
|
|
52
97
|
(config.commands?.pr?.requirementsProvider ?? config.requirementsProvider) === 'jira' &&
|
|
53
98
|
config.commands?.pr?.logWorkForReviewInSeconds) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prCommand.js","sourceRoot":"","sources":["../../src/commands/prCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,gCAAgC,EAChC,qBAAqB,GACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAiC,MAAM,mBAAmB,CAAC;AAC1F,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"prCommand.js","sourceRoot":"","sources":["../../src/commands/prCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,gCAAgC,EAChC,qBAAqB,GACtB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAiC,MAAM,mBAAmB,CAAC;AAC1F,OAAO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C,CAAC;QAC1E,0CAA0C;QAC1C,qBAAqB;QACrB,MAAM,MAAM,CACV,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,CAAC,cAAc,EACpC,qBAAqB,CAAC,MAAM,CAAC,EAC7B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAClB,MAAM,EACN,IAAI,EACJ,eAAe,EAAE,CAClB,CAAC;QAEF,IACE,cAAc;YACd,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,oBAAoB,IAAI,MAAM,CAAC,oBAAoB,CAAC,KAAK,MAAM;YACrF,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,yBAAyB,EAC9C,CAAC;YACD,0DAA0D;YAC1D,IAAI,UAAU,GACZ,MAAM,CAAC,kBAAkB,EAAE,IAAI;gBAC9B,MAAM,CAAC,0BAA0B,EAAE,IAAmB,CAAC;YAC1D,MAAM,WAAW,CACf,UAAU,EACV,cAAc,EACd,MAAM,CAAC,QAAQ,EAAE,EAAE,EAAE,yBAAyB,EAC9C,aAAa,CACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { CustomToolsConfig, GthConfig, ServerTool } from '@gaunt-sloth/core/config.js';
|
|
2
|
+
import { type BaseToolkit, StructuredToolInterface } from '@langchain/core/tools';
|
|
3
|
+
export declare const GSLOTH_PR_DISCOVERY_PROMPT = ".gsloth.pr-discovery.md";
|
|
4
|
+
export interface PrDiscoveryConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Enable change requirements discovery when neither PR id nor requirements id is provided.
|
|
7
|
+
* @default true
|
|
8
|
+
*/
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Fetch the current-branch PR diff with `gh pr diff` before invoking the discovery agent.
|
|
12
|
+
* The discovery agent can still replace it with the `set_diff` tool if needed.
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
15
|
+
deterministicDiff?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Optional tool overrides used only while the discovery agent runs.
|
|
18
|
+
* When omitted, the normal configured tools remain available.
|
|
19
|
+
*/
|
|
20
|
+
filesystem?: string[] | 'all' | 'read' | 'none';
|
|
21
|
+
builtInTools?: string[];
|
|
22
|
+
customTools?: CustomToolsConfig | false;
|
|
23
|
+
tools?: StructuredToolInterface[] | BaseToolkit[] | ServerTool[];
|
|
24
|
+
/**
|
|
25
|
+
* Restrict the discovery agent to this allow-list of tool names, applied after every tool
|
|
26
|
+
* source (filesystem, built-in, custom, MCP, A2A, and `tools`) is resolved. Unlike
|
|
27
|
+
* `builtInTools`/`customTools`/`filesystem` (which gate whole tool groups), this trims the
|
|
28
|
+
* final tool set by exact name, so it can pare down MCP server tools
|
|
29
|
+
* (e.g. "mcp__jira__getJiraIssue") and the discovery helper tools
|
|
30
|
+
* ("gh_pr"/"gh_diff"/"gh_issue"/"set_diff") to the minimum needed.
|
|
31
|
+
*
|
|
32
|
+
* `set_requirements` is always retained regardless, since it is how the discovery agent
|
|
33
|
+
* records the requirements it found. When omitted, all resolved tools remain available; an
|
|
34
|
+
* empty array keeps only `set_requirements`. The discovery agent never inherits the
|
|
35
|
+
* top-level {@link GthConfig.allowedTools}; this property is its only allow-list.
|
|
36
|
+
*/
|
|
37
|
+
allowedTools?: string[];
|
|
38
|
+
}
|
|
39
|
+
declare module '@gaunt-sloth/core/config.js' {
|
|
40
|
+
interface PrCommandConfig {
|
|
41
|
+
/** Change requirements discovery (`gth pr` with no arguments) configuration. */
|
|
42
|
+
discovery?: PrDiscoveryConfig;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Read the PR discovery agent prompt, honouring project / identity-profile
|
|
47
|
+
* overrides and falling back to the default prompt shipped with the assistant package.
|
|
48
|
+
*/
|
|
49
|
+
export declare function readPrDiscoveryPrompt(config: Pick<GthConfig, 'identityProfile' | 'noDefaultPrompts'>): string;
|
|
50
|
+
export interface PrDiscoveryResult {
|
|
51
|
+
diff: string;
|
|
52
|
+
requirements: string;
|
|
53
|
+
}
|
|
54
|
+
export declare function runPrDiscovery(config: GthConfig): Promise<PrDiscoveryResult>;
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
import { GthAgentRunner } from '@gaunt-sloth/core/core/GthAgentRunner.js';
|
|
2
|
+
import { defaultStatusCallback, displayInfo, displayWarning, } from '@gaunt-sloth/core/utils/consoleUtils.js';
|
|
3
|
+
import { buildSystemMessages, readPromptFile } from '@gaunt-sloth/core/utils/llmUtils.js';
|
|
4
|
+
import { debugLog } from '@gaunt-sloth/core/utils/debugUtils.js';
|
|
5
|
+
import { HumanMessage } from '@langchain/core/messages';
|
|
6
|
+
import { tool } from '@langchain/core/tools';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { dirname, resolve } from 'node:path';
|
|
9
|
+
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { createResolvers } from '@gaunt-sloth/api/resolvers.js';
|
|
11
|
+
import { get as getGhPrDiff } from '@gaunt-sloth/review/sources/ghPrDiffSource.js';
|
|
12
|
+
import { get as getGhPrView } from '@gaunt-sloth/review/sources/ghPrViewSource.js';
|
|
13
|
+
import { get as getGhIssue } from '@gaunt-sloth/review/sources/ghIssueSource.js';
|
|
14
|
+
import { get as getJiraIssue } from '@gaunt-sloth/review/sources/jiraIssueSource.js';
|
|
15
|
+
import { get as getJiraIssueLegacy } from '@gaunt-sloth/review/sources/jiraIssueLegacySource.js';
|
|
16
|
+
export const GSLOTH_PR_DISCOVERY_PROMPT = '.gsloth.pr-discovery.md';
|
|
17
|
+
// The assistant package root (src|dist/commands -> package root), where the packaged default
|
|
18
|
+
// .gsloth.pr-discovery.md ships.
|
|
19
|
+
const assistantPackageDir = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
20
|
+
/**
|
|
21
|
+
* Read the PR discovery agent prompt, honouring project / identity-profile
|
|
22
|
+
* overrides and falling back to the default prompt shipped with the assistant package.
|
|
23
|
+
*/
|
|
24
|
+
export function readPrDiscoveryPrompt(config) {
|
|
25
|
+
return readPromptFile(GSLOTH_PR_DISCOVERY_PROMPT, config.identityProfile, config.noDefaultPrompts, assistantPackageDir);
|
|
26
|
+
}
|
|
27
|
+
const SetDiffArgsSchema = z.object({
|
|
28
|
+
diff: z.string().describe('Complete pull request diff text to use for the review.'),
|
|
29
|
+
});
|
|
30
|
+
const SetRequirementsArgsSchema = z.object({
|
|
31
|
+
requirements: z.string().describe('Complete requirements text to use for the review.'),
|
|
32
|
+
});
|
|
33
|
+
const GhDiffArgsSchema = z.object({
|
|
34
|
+
prId: z
|
|
35
|
+
.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('GitHub PR number. Omit to fetch the PR diff for the current branch.'),
|
|
38
|
+
});
|
|
39
|
+
const GhPrArgsSchema = z.object({
|
|
40
|
+
prId: z
|
|
41
|
+
.string()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('GitHub PR number. Omit to fetch metadata for the current branch PR.'),
|
|
44
|
+
});
|
|
45
|
+
const GhIssueArgsSchema = z.object({
|
|
46
|
+
issueId: z
|
|
47
|
+
.string()
|
|
48
|
+
.describe('GitHub issue number or full issue URL to retrieve. Use the full URL for issues in other repositories.'),
|
|
49
|
+
});
|
|
50
|
+
export async function runPrDiscovery(config) {
|
|
51
|
+
const discoveryConfig = config.commands?.pr?.discovery;
|
|
52
|
+
const state = {
|
|
53
|
+
diff: '',
|
|
54
|
+
requirements: '',
|
|
55
|
+
prMetadata: '',
|
|
56
|
+
};
|
|
57
|
+
const contentProvider = config.commands?.pr?.contentProvider ?? config.contentProvider;
|
|
58
|
+
if (discoveryConfig?.deterministicDiff !== false) {
|
|
59
|
+
if (contentProvider !== 'github') {
|
|
60
|
+
// The deterministic fast path uses `gh pr diff`, which only makes sense for the GitHub
|
|
61
|
+
// content provider. For any other provider, skip it (rather than emitting a spurious gh
|
|
62
|
+
// failure warning) and let the discovery agent fetch the diff via its tools.
|
|
63
|
+
debugLog(`Skipped the deterministic gh diff fetch because the content provider is "${contentProvider}", not "github".`);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
try {
|
|
67
|
+
const diff = await getGhPrDiff(getGithubContentProviderConfig(config), undefined);
|
|
68
|
+
state.diff = diff ?? '';
|
|
69
|
+
if (state.diff) {
|
|
70
|
+
displayInfo('Retrieved current-branch PR diff with gh.');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
displayWarning(`Could not deterministically retrieve current-branch PR diff: ${error instanceof Error ? error.message : String(error)}`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
try {
|
|
79
|
+
const prMetadata = await getGhPrView(getGithubContentProviderConfig(config), undefined);
|
|
80
|
+
state.prMetadata = prMetadata ?? '';
|
|
81
|
+
if (state.prMetadata) {
|
|
82
|
+
const prNumber = extractGithubPrNumber(state.prMetadata);
|
|
83
|
+
displayInfo(prNumber
|
|
84
|
+
? `Retrieved current-branch PR #${prNumber} metadata with gh.`
|
|
85
|
+
: 'Retrieved current-branch PR metadata with gh.');
|
|
86
|
+
state.requirements = await discoverRequirementsFromPrMetadata(config, state.prMetadata);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
const message = `Could not retrieve current-branch PR metadata: ${error instanceof Error ? error.message : String(error)}`;
|
|
91
|
+
// The metadata fetch (gh pr view) still runs for non-github content providers, because a
|
|
92
|
+
// GitHub PR can legitimately be reviewed with a non-github diff source. But in a fully
|
|
93
|
+
// non-github setup a failure here is expected noise, so log it at debug level rather than
|
|
94
|
+
// warning - mirroring how the deterministic diff path stays quiet off GitHub.
|
|
95
|
+
if (contentProvider === 'github') {
|
|
96
|
+
displayWarning(message);
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
debugLog(message);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (state.diff.trim() && state.requirements.trim()) {
|
|
103
|
+
displayInfo('Resolved the PR diff and requirements deterministically; skipping the discovery agent.');
|
|
104
|
+
return {
|
|
105
|
+
diff: state.diff.trim(),
|
|
106
|
+
requirements: state.requirements.trim(),
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// If the discovery agent is our only chance to obtain a diff (none was set deterministically)
|
|
110
|
+
// but the allow-list filters out every diff tool, it can never set one and the command is
|
|
111
|
+
// guaranteed to fail later with "Change requirements discovery did not produce a diff". Warn early so the
|
|
112
|
+
// misconfiguration is obvious rather than surfacing as an opaque downstream failure.
|
|
113
|
+
if (!state.diff.trim() &&
|
|
114
|
+
discoveryConfig?.allowedTools &&
|
|
115
|
+
!discoveryConfig.allowedTools.includes('gh_diff') &&
|
|
116
|
+
!discoveryConfig.allowedTools.includes('set_diff')) {
|
|
117
|
+
displayWarning('No diff yet and commands.pr.discovery.allowedTools excludes both "gh_diff" and "set_diff", so the discovery agent cannot set one. Add "gh_diff" (or "set_diff") to the allow-list, or enable deterministicDiff.');
|
|
118
|
+
}
|
|
119
|
+
const runner = new GthAgentRunner(defaultStatusCallback, createPrDiscoveryResolvers(config, state));
|
|
120
|
+
try {
|
|
121
|
+
await runner.init(undefined, getPrDiscoveryAgentConfig(config, discoveryConfig), undefined);
|
|
122
|
+
await runner.processMessages([
|
|
123
|
+
...buildSystemMessages(config, readPrDiscoveryPrompt(config)),
|
|
124
|
+
new HumanMessage(buildPrDiscoveryUserMessage(state)),
|
|
125
|
+
]);
|
|
126
|
+
}
|
|
127
|
+
finally {
|
|
128
|
+
await runner.cleanup();
|
|
129
|
+
}
|
|
130
|
+
// The discovery agent streams its final text without a trailing newline, so emit a
|
|
131
|
+
// blank line to separate it from the review agent's output that follows.
|
|
132
|
+
displayInfo('');
|
|
133
|
+
return {
|
|
134
|
+
diff: state.diff.trim(),
|
|
135
|
+
requirements: state.requirements.trim(),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function getPrDiscoveryAgentConfig(config, discoveryConfig) {
|
|
139
|
+
const baseTools = discoveryConfig?.tools ?? config.tools ?? [];
|
|
140
|
+
const customTools = discoveryConfig && 'customTools' in discoveryConfig
|
|
141
|
+
? discoveryConfig.customTools
|
|
142
|
+
: config.customTools;
|
|
143
|
+
return {
|
|
144
|
+
...config,
|
|
145
|
+
filesystem: discoveryConfig?.filesystem ?? config.filesystem,
|
|
146
|
+
builtInTools: discoveryConfig?.builtInTools ?? config.builtInTools,
|
|
147
|
+
customTools: customTools === false ? undefined : customTools,
|
|
148
|
+
tools: baseTools,
|
|
149
|
+
// The discovery agent must never inherit the top-level allow-list (e.g. a global
|
|
150
|
+
// `allowedTools: []` meant to keep review agents tool-free would strip set_requirements
|
|
151
|
+
// and silently neuter discovery). Only `commands.pr.discovery.allowedTools` applies here,
|
|
152
|
+
// always augmented with set_requirements so the agent can record what it found. The
|
|
153
|
+
// agent applies this list after every tool source is resolved, so it also gates tools
|
|
154
|
+
// supplied via `tools` in config.
|
|
155
|
+
allowedTools: discoveryConfig?.allowedTools
|
|
156
|
+
? [...new Set([...discoveryConfig.allowedTools, 'set_requirements'])]
|
|
157
|
+
: undefined,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
function createPrDiscoveryResolvers(config, state) {
|
|
161
|
+
const baseResolvers = createResolvers();
|
|
162
|
+
return {
|
|
163
|
+
...baseResolvers,
|
|
164
|
+
resolveTools: async (effectiveConfig, command) => {
|
|
165
|
+
const baseTools = baseResolvers.resolveTools
|
|
166
|
+
? await baseResolvers.resolveTools(effectiveConfig, command)
|
|
167
|
+
: [];
|
|
168
|
+
return [...baseTools, ...createPrDiscoveryTools(config, state)];
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function createPrDiscoveryTools(config, state) {
|
|
173
|
+
const setDiff = tool(async ({ diff }) => {
|
|
174
|
+
state.diff = diff;
|
|
175
|
+
return 'Diff set for PR review.';
|
|
176
|
+
}, {
|
|
177
|
+
name: 'set_diff',
|
|
178
|
+
description: 'Set the exact pull request diff text that the PR review should use.',
|
|
179
|
+
schema: SetDiffArgsSchema,
|
|
180
|
+
});
|
|
181
|
+
const setRequirements = tool(async ({ requirements }) => {
|
|
182
|
+
state.requirements = requirements;
|
|
183
|
+
return 'Requirements set for PR review.';
|
|
184
|
+
}, {
|
|
185
|
+
name: 'set_requirements',
|
|
186
|
+
description: 'Set the exact requirements text that the PR review should use.',
|
|
187
|
+
schema: SetRequirementsArgsSchema,
|
|
188
|
+
});
|
|
189
|
+
const ghPr = tool(async ({ prId }) => {
|
|
190
|
+
try {
|
|
191
|
+
return (await getGhPrView(getGithubContentProviderConfig(config), prId)) ?? '';
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
// Return the failure as text rather than throwing, so a single failed fetch (e.g. no PR
|
|
195
|
+
// for the current branch) lets the model adapt instead of aborting the whole discovery
|
|
196
|
+
// run - consistent with gh_issue's actionable-message behaviour.
|
|
197
|
+
return `Could not fetch GitHub PR metadata: ${error instanceof Error ? error.message : String(error)}`;
|
|
198
|
+
}
|
|
199
|
+
}, {
|
|
200
|
+
name: 'gh_pr',
|
|
201
|
+
description: 'Fetch GitHub pull request metadata including title, branch names, URL, and description/body. Omit prId to fetch the current branch PR.',
|
|
202
|
+
schema: GhPrArgsSchema,
|
|
203
|
+
});
|
|
204
|
+
const ghDiff = tool(async ({ prId }) => {
|
|
205
|
+
let diff;
|
|
206
|
+
try {
|
|
207
|
+
diff = (await getGhPrDiff(getGithubContentProviderConfig(config), prId)) ?? '';
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
// Surface the failure as text instead of throwing so the discovery run continues and the
|
|
211
|
+
// model can try another approach - consistent with gh_pr/gh_issue.
|
|
212
|
+
return `Could not fetch the GitHub PR diff: ${error instanceof Error ? error.message : String(error)}; the review diff was not changed.`;
|
|
213
|
+
}
|
|
214
|
+
if (!diff) {
|
|
215
|
+
return 'No diff content was returned by GitHub CLI; the review diff was not changed.';
|
|
216
|
+
}
|
|
217
|
+
// Store the diff directly instead of returning it: echoing a large diff into the
|
|
218
|
+
// model context just so the model can copy it verbatim into set_diff doubles token
|
|
219
|
+
// cost and lets weaker models truncate or corrupt the diff on the way through.
|
|
220
|
+
state.diff = diff;
|
|
221
|
+
const preview = diff.split('\n').slice(0, 10).join('\n');
|
|
222
|
+
return `Retrieved the PR diff (${diff.length} characters) and set it as the review diff; no need to call set_diff. Preview:\n${preview}`;
|
|
223
|
+
}, {
|
|
224
|
+
name: 'gh_diff',
|
|
225
|
+
description: 'Fetch a GitHub pull request diff using GitHub CLI and set it as the review diff. ' +
|
|
226
|
+
'Omit prId to fetch the PR for the current branch. ' +
|
|
227
|
+
'Returns a confirmation with a short preview; the full diff is stored without needing set_diff.',
|
|
228
|
+
schema: GhDiffArgsSchema,
|
|
229
|
+
});
|
|
230
|
+
const ghIssue = tool(async ({ issueId }) => {
|
|
231
|
+
const issue = await getGhIssue(getGithubRequirementsProviderConfig(config), issueId);
|
|
232
|
+
if (issue) {
|
|
233
|
+
return issue;
|
|
234
|
+
}
|
|
235
|
+
// The source returns null on a rejected reference (only a bare number or a full
|
|
236
|
+
// https://github.com/<owner>/<repo>/issues/<number> URL is accepted - note http:// and
|
|
237
|
+
// other hosts are rejected), or when the issue has no content. Surface an actionable
|
|
238
|
+
// reason instead of an empty string so the model can self-correct rather than stall.
|
|
239
|
+
return `No issue content was returned for "${issueId}". The reference may be invalid (expected an issue number or a full https://github.com/<owner>/<repo>/issues/<number> URL) or the issue may not exist.`;
|
|
240
|
+
}, {
|
|
241
|
+
name: 'gh_issue',
|
|
242
|
+
description: 'Fetch a GitHub issue description using GitHub CLI.',
|
|
243
|
+
schema: GhIssueArgsSchema,
|
|
244
|
+
});
|
|
245
|
+
return [setDiff, setRequirements, ghPr, ghDiff, ghIssue];
|
|
246
|
+
}
|
|
247
|
+
function getProviderConfig(config) {
|
|
248
|
+
return config && typeof config === 'object' ? config : null;
|
|
249
|
+
}
|
|
250
|
+
function getGithubContentProviderConfig(config) {
|
|
251
|
+
return getProviderConfig(config.contentSourceConfig?.github ?? config.contentProviderConfig?.github);
|
|
252
|
+
}
|
|
253
|
+
function getGithubRequirementsProviderConfig(config) {
|
|
254
|
+
return getProviderConfig(config.requirementSourceConfig?.github ?? config.requirementsProviderConfig?.github);
|
|
255
|
+
}
|
|
256
|
+
function getJiraRequirementsProviderConfig(config) {
|
|
257
|
+
// builtInToolsConfig.jira takes precedence because it is the canonical Jira credential location
|
|
258
|
+
// (shared with the Jira MCP/built-in tooling); the requirementSource/requirementsProvider
|
|
259
|
+
// entries are the older provider-scoped fallbacks. If a user sets both with different cloudIds,
|
|
260
|
+
// the deterministic fast path uses the built-in config - keep them in sync to avoid surprises.
|
|
261
|
+
return getProviderConfig(config.builtInToolsConfig?.jira ??
|
|
262
|
+
config.requirementSourceConfig?.jira ??
|
|
263
|
+
config.requirementsProviderConfig?.jira);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Deterministically resolve requirements from PR metadata, using a fast path that matches
|
|
267
|
+
* the configured requirements provider. Falls back to '' when nothing is found, leaving the
|
|
268
|
+
* discovery agent to resolve requirements.
|
|
269
|
+
*/
|
|
270
|
+
async function discoverRequirementsFromPrMetadata(config, prMetadata) {
|
|
271
|
+
const requirementsProvider = config.commands?.pr?.requirementsProvider ?? config.requirementsProvider;
|
|
272
|
+
if (requirementsProvider === 'jira' || requirementsProvider === 'jira-legacy') {
|
|
273
|
+
const issueKey = extractJiraIssueKey(prMetadata);
|
|
274
|
+
if (!issueKey) {
|
|
275
|
+
return '';
|
|
276
|
+
}
|
|
277
|
+
const jiraConfig = getJiraRequirementsProviderConfig(config);
|
|
278
|
+
try {
|
|
279
|
+
const requirements = (requirementsProvider === 'jira-legacy'
|
|
280
|
+
? await getJiraIssueLegacy(jiraConfig, issueKey)
|
|
281
|
+
: await getJiraIssue(jiraConfig, issueKey)) ?? '';
|
|
282
|
+
if (requirements) {
|
|
283
|
+
displayInfo(`Discovered requirements from Jira issue ${issueKey} linked in the PR description.`);
|
|
284
|
+
}
|
|
285
|
+
return requirements;
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
// The deterministic Jira fast path uses the Jira REST API, which needs its own
|
|
289
|
+
// credentials (PAT / base64 token) that are independent of any Jira MCP OAuth. When
|
|
290
|
+
// those aren't configured - e.g. an MCP-only setup - skip quietly and let the discovery
|
|
291
|
+
// agent resolve requirements via its tools (e.g. the Jira MCP server).
|
|
292
|
+
debugLog(`Skipped the deterministic Jira REST lookup for ${issueKey}: ${error instanceof Error ? error.message : String(error)}`);
|
|
293
|
+
return '';
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
const requirementsIssueRef = extractRequirementsGithubIssueRef(prMetadata);
|
|
297
|
+
if (!requirementsIssueRef) {
|
|
298
|
+
return '';
|
|
299
|
+
}
|
|
300
|
+
const requirements = (await getGhIssue(getGithubRequirementsProviderConfig(config), requirementsIssueRef)) ?? '';
|
|
301
|
+
if (requirements) {
|
|
302
|
+
displayInfo(`Discovered requirements from GitHub issue ${formatGithubIssueRef(requirementsIssueRef)} linked in the PR description.`);
|
|
303
|
+
}
|
|
304
|
+
return requirements;
|
|
305
|
+
}
|
|
306
|
+
// Match an explicit "Requirements:" label (singular or plural) rather than any line that merely
|
|
307
|
+
// mentions the word. Prose like "This tightens the requirements validation, see #42" must not be
|
|
308
|
+
// treated as a requirements pointer; only a labelled line (e.g. "Requirements: <link>") is.
|
|
309
|
+
const REQUIREMENTS_LABEL_PATTERN = /requirements?\s*:/i;
|
|
310
|
+
// Owner/repo segments are restricted to GitHub's name charset; anything looser would let a
|
|
311
|
+
// crafted PR description smuggle shell metacharacters into the `gh issue view` command line.
|
|
312
|
+
const GITHUB_ISSUE_URL_PATTERN = /(?:https?:\/\/)?github\.com\/[\w.-]+\/[\w.-]+\/issues\/\d+/i;
|
|
313
|
+
// GitHub closing keywords (https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)
|
|
314
|
+
const GITHUB_CLOSING_KEYWORD_PATTERN = /\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?):?\s+#(\d+)\b/i;
|
|
315
|
+
/**
|
|
316
|
+
* Return just the PR description body - the lines after the "Description:" marker emitted by
|
|
317
|
+
* {@link formatPrView}. The requirements-line scan must not see the structured header fields
|
|
318
|
+
* (notably "Title:"), or a title like "Clarify requirements doc, see #42" would be misread as a
|
|
319
|
+
* requirements pointer. Falls back to the full text when no marker is present.
|
|
320
|
+
*/
|
|
321
|
+
function getPrDescriptionBody(prMetadata) {
|
|
322
|
+
const lines = prMetadata.split('\n');
|
|
323
|
+
const descriptionIndex = lines.findIndex((line) => line.trim() === 'Description:');
|
|
324
|
+
return descriptionIndex === -1 ? prMetadata : lines.slice(descriptionIndex + 1).join('\n');
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Return just the structured header that {@link formatPrView} emits before the "Description:"
|
|
328
|
+
* marker (PR number, Title, URL, branches). Scans for structured fields (e.g. "Head branch:")
|
|
329
|
+
* must use this rather than the full text, or a body line mimicking a header label could spoof
|
|
330
|
+
* a value. Falls back to the full text when no marker is present.
|
|
331
|
+
*/
|
|
332
|
+
function getPrMetadataHeader(prMetadata) {
|
|
333
|
+
const lines = prMetadata.split('\n');
|
|
334
|
+
const descriptionIndex = lines.findIndex((line) => line.trim() === 'Description:');
|
|
335
|
+
return descriptionIndex === -1 ? prMetadata : lines.slice(0, descriptionIndex).join('\n');
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Extract a GitHub issue reference (a full issue URL or a bare issue number) that the PR
|
|
339
|
+
* description explicitly designates as requirements. URLs are returned whole rather than as
|
|
340
|
+
* extracted numbers, because a cross-repo issue URL reduced to its number would make
|
|
341
|
+
* `gh issue view` fetch the same-numbered issue from the wrong (current) repository.
|
|
342
|
+
*/
|
|
343
|
+
function extractRequirementsGithubIssueRef(prMetadata) {
|
|
344
|
+
const requirementsLine = getPrDescriptionBody(prMetadata)
|
|
345
|
+
.split('\n')
|
|
346
|
+
.find((line) => REQUIREMENTS_LABEL_PATTERN.test(line));
|
|
347
|
+
if (requirementsLine) {
|
|
348
|
+
const urlMatch = requirementsLine.match(GITHUB_ISSUE_URL_PATTERN);
|
|
349
|
+
if (urlMatch) {
|
|
350
|
+
return normalizeGithubIssueUrl(urlMatch[0]);
|
|
351
|
+
}
|
|
352
|
+
const hashIssueMatch = requirementsLine.match(/#(\d+)/);
|
|
353
|
+
if (hashIssueMatch?.[1]) {
|
|
354
|
+
return hashIssueMatch[1];
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
// A closing keyword ("Closes #123", "Fixes #123") is an explicit statement that the PR
|
|
358
|
+
// implements that issue, so it is a reliable requirements pointer. Searching the full
|
|
359
|
+
// formatted metadata is intentional: non-description fields are structured labels emitted by
|
|
360
|
+
// formatPrView, and a closing-keyword phrase in the title is still an explicit PR signal.
|
|
361
|
+
const closingMatch = prMetadata.match(GITHUB_CLOSING_KEYWORD_PATTERN);
|
|
362
|
+
if (closingMatch?.[1]) {
|
|
363
|
+
return closingMatch[1];
|
|
364
|
+
}
|
|
365
|
+
// Otherwise fall back to an issue URL anywhere in the body, but only when it is
|
|
366
|
+
// unambiguous: with several distinct issue links (e.g. "see also" references) picking one
|
|
367
|
+
// would silently review against the wrong requirements, so leave it to the discovery agent.
|
|
368
|
+
// Scan only the description body (not the structured header), consistent with the
|
|
369
|
+
// requirements-line scan above - a lone issue URL in the Title is not a requirements pointer.
|
|
370
|
+
const bodyUrls = new Set(Array.from(getPrDescriptionBody(prMetadata).matchAll(new RegExp(GITHUB_ISSUE_URL_PATTERN, 'gi'))).map((match) => normalizeGithubIssueUrl(match[0])));
|
|
371
|
+
if (bodyUrls.size === 1) {
|
|
372
|
+
return bodyUrls.values().next().value;
|
|
373
|
+
}
|
|
374
|
+
return undefined;
|
|
375
|
+
}
|
|
376
|
+
function normalizeGithubIssueUrl(url) {
|
|
377
|
+
// Lowercase the host and the "/issues/" path segment so a copied "GITHUB.COM/.../ISSUES/77"
|
|
378
|
+
// URL still satisfies the case-sensitive issue-reference check in ghIssueSource. Owner/repo
|
|
379
|
+
// segments are left untouched because they are case-sensitive on GitHub.
|
|
380
|
+
const withoutProtocol = url.replace(/^https?:\/\//i, '');
|
|
381
|
+
return `https://${withoutProtocol
|
|
382
|
+
.replace(/^github\.com/i, 'github.com')
|
|
383
|
+
.replace(/\/issues\//i, '/issues/')}`;
|
|
384
|
+
}
|
|
385
|
+
function formatGithubIssueRef(ref) {
|
|
386
|
+
return /^\d+$/.test(ref) ? `#${ref}` : ref;
|
|
387
|
+
}
|
|
388
|
+
function extractGithubPrNumber(prMetadata) {
|
|
389
|
+
// formatPrView emits "GitHub PR: #<number>" as the first line when the number is known. Anchor
|
|
390
|
+
// to that first line so a PR body that merely contains the literal "GitHub PR: #123" cannot
|
|
391
|
+
// spoof the number shown in the info message.
|
|
392
|
+
return prMetadata.split('\n', 1)[0].match(/^GitHub PR:\s*#(\d+)/)?.[1];
|
|
393
|
+
}
|
|
394
|
+
// Jira project keys are at least two letters followed by letters/digits (e.g. ABC-123,
|
|
395
|
+
// never A-1). Kept case-sensitive for bare keys: lowercase look-alikes in branch names or
|
|
396
|
+
// prose ("fix-123") are too ambiguous for the deterministic path.
|
|
397
|
+
const JIRA_ISSUE_KEY_PATTERN = /\b([A-Z]{2}[A-Z0-9]*-\d+)\b/;
|
|
398
|
+
// Atlassian browse URL, e.g. https://company.atlassian.net/browse/ABC-123. Unlike bare keys,
|
|
399
|
+
// URL-extracted keys are matched case-insensitively and normalized because the structured
|
|
400
|
+
// /browse/<key> path makes the intent clear while copied URLs can vary in casing.
|
|
401
|
+
const ATLASSIAN_BROWSE_URL_PATTERN = /atlassian\.net\/browse\/([A-Z]{2}[A-Z0-9]*-\d+)/i;
|
|
402
|
+
function extractJiraIssueKey(prMetadata) {
|
|
403
|
+
const requirementsLine = getPrDescriptionBody(prMetadata)
|
|
404
|
+
.split('\n')
|
|
405
|
+
.find((line) => REQUIREMENTS_LABEL_PATTERN.test(line));
|
|
406
|
+
if (requirementsLine) {
|
|
407
|
+
const urlMatch = requirementsLine.match(ATLASSIAN_BROWSE_URL_PATTERN);
|
|
408
|
+
if (urlMatch?.[1]) {
|
|
409
|
+
return urlMatch[1].toUpperCase();
|
|
410
|
+
}
|
|
411
|
+
// Bare ticket key on a requirements line, e.g. "Requirements: ABC-123"
|
|
412
|
+
const keyMatch = requirementsLine.match(JIRA_ISSUE_KEY_PATTERN);
|
|
413
|
+
if (keyMatch?.[1]) {
|
|
414
|
+
return keyMatch[1];
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
// A key in the head branch name (feature/ABC-123-description convention) is an explicit
|
|
418
|
+
// statement of which issue the branch implements. Scan only the structured header so a body
|
|
419
|
+
// line mimicking "Head branch: feature/XX-1-..." cannot inject a key when headRefName is absent.
|
|
420
|
+
const headBranchLine = getPrMetadataHeader(prMetadata)
|
|
421
|
+
.split('\n')
|
|
422
|
+
.find((line) => line.startsWith('Head branch:'));
|
|
423
|
+
const branchKeyMatch = headBranchLine?.match(JIRA_ISSUE_KEY_PATTERN);
|
|
424
|
+
if (branchKeyMatch?.[1]) {
|
|
425
|
+
return branchKeyMatch[1];
|
|
426
|
+
}
|
|
427
|
+
// Otherwise fall back to an Atlassian browse URL anywhere in the body, but - mirroring the
|
|
428
|
+
// GitHub path - only when it is unambiguous: with several distinct links (e.g. "see also"
|
|
429
|
+
// references) picking one would silently review against the wrong requirements. Scan only the
|
|
430
|
+
// description body (not the structured header), consistent with the requirements-line scan.
|
|
431
|
+
const bodyKeys = new Set(Array.from(getPrDescriptionBody(prMetadata).matchAll(new RegExp(ATLASSIAN_BROWSE_URL_PATTERN, 'gi'))).map((match) => match[1].toUpperCase()));
|
|
432
|
+
if (bodyKeys.size === 1) {
|
|
433
|
+
return bodyKeys.values().next().value;
|
|
434
|
+
}
|
|
435
|
+
return undefined;
|
|
436
|
+
}
|
|
437
|
+
function buildPrDiscoveryUserMessage(state) {
|
|
438
|
+
const diffStatus = state.diff
|
|
439
|
+
? 'A current-branch PR diff has already been deterministically retrieved and set. Verify whether it is sufficient; replace it (gh_diff sets it automatically, or use set_diff) only if you find a better exact diff.'
|
|
440
|
+
: 'No PR diff has been set yet. Retrieve the PR diff with gh_diff, which stores it automatically; use set_diff only for a diff obtained some other way.';
|
|
441
|
+
const requirementsStatus = state.requirements
|
|
442
|
+
? 'Requirements have already been retrieved from the PR description. Verify whether they are sufficient; replace them with set_requirements only if you find better exact requirements.'
|
|
443
|
+
: 'Requirements have not been set yet. First inspect the PR description below for an explicit requirements link before trying issue-number guesses.';
|
|
444
|
+
const prMetadataBlock = state.prMetadata
|
|
445
|
+
? `\n\nCurrent PR metadata already fetched with gh_pr:\n<pr-metadata>\n${state.prMetadata}\n</pr-metadata>`
|
|
446
|
+
: '';
|
|
447
|
+
return `${diffStatus}\n\n${requirementsStatus}${prMetadataBlock}
|
|
448
|
+
|
|
449
|
+
Discover the requirements for the current PR, then call set_requirements. Prefer an explicit requirements link from the PR description over searching nearby issue numbers. You may inspect linked GitHub issues, Jira MCP tools, and any other configured tools. Finish only after the diff and requirements have both been set.`;
|
|
450
|
+
}
|
|
451
|
+
//# sourceMappingURL=prDiscovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prDiscovery.js","sourceRoot":"","sources":["../../src/commands/prDiscovery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,WAAW,EACX,cAAc,GACf,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAA6C,IAAI,EAA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,KAAK,CAAC,YAAY;QAC3C,CAAC,CAAC,sLAAsL;QACxL,CAAC,CAAC,kJAAkJ,CAAC;IAEvJ,MAAM,eAAe,GAAG,KAAK,CAAC,UAAU;QACtC,CAAC,CAAC,uEAAuE,KAAK,CAAC,UAAU,kBAAkB;QAC3G,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,GAAG,UAAU,OAAO,kBAAkB,GAAG,eAAe;;kUAEiQ,CAAC;AACnU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gaunt-sloth-assistant",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Andrew Kondratev",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"gth": "cli.js"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@gaunt-sloth/api": "0.1.
|
|
40
|
-
"@gaunt-sloth/core": "0.1.
|
|
41
|
-
"@gaunt-sloth/review": "0.1.
|
|
42
|
-
"@gaunt-sloth/tools": "0.1.
|
|
39
|
+
"@gaunt-sloth/api": "0.1.7",
|
|
40
|
+
"@gaunt-sloth/core": "0.1.7",
|
|
41
|
+
"@gaunt-sloth/review": "0.1.7",
|
|
42
|
+
"@gaunt-sloth/tools": "0.1.7",
|
|
43
43
|
"@langchain/anthropic": "^1.4.0",
|
|
44
44
|
"@langchain/core": "^1.1.48",
|
|
45
45
|
"@langchain/deepseek": "^1.0.27",
|