gaunt-sloth-assistant 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -53
- package/assets/gaunt-sloth-logo.png +0 -0
- package/assets/release-notes/v0_4_0.md +39 -0
- package/dist/commands/askCommand.js +14 -3
- package/dist/commands/askCommand.js.map +1 -1
- package/dist/commands/reviewCommand.js +13 -10
- package/dist/commands/reviewCommand.js.map +1 -1
- package/dist/config.d.ts +10 -7
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/configs/anthropic.js +3 -4
- package/dist/configs/anthropic.js.map +1 -1
- package/dist/providers/ghIssueProvider.d.ts +8 -0
- package/dist/providers/ghIssueProvider.js +31 -0
- package/dist/providers/ghIssueProvider.js.map +1 -0
- package/dist/providers/ghPrDiffProvider.d.ts +4 -4
- package/dist/providers/ghPrDiffProvider.js +22 -7
- package/dist/providers/ghPrDiffProvider.js.map +1 -1
- package/docs/CONFIGURATION.md +76 -4
- package/docs/DEVELOPMENT.md +1 -2
- package/docs/RELEASE-HOWTO.md +4 -0
- package/eslint.config.js +1 -1
- package/maintenance/doc-maintenance.md +8 -0
- package/package.json +5 -4
- package/src/commands/askCommand.ts +16 -3
- package/src/commands/reviewCommand.ts +17 -10
- package/src/config.ts +12 -9
- package/src/configs/anthropic.ts +3 -4
- package/src/providers/ghIssueProvider.ts +37 -0
- package/src/providers/ghPrDiffProvider.ts +24 -7
- package/tsconfig.json +1 -1
- package/vitest-it.config.ts +14 -0
package/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# Gaunt Sloth Assistant
|
2
2
|
[](https://github.com/andruhon/gaunt-sloth-assistant/actions/workflows/ci.yml)
|
3
3
|
|
4
|
-
Gaunt
|
5
|
-
|
6
|
-
|
4
|
+
Gaunt GSloth Assistant is a lightweight **command line AI assistant** for software developers
|
5
|
+
designed to enhance code review quality while reducing cognitive load and time investment on **code reviews**
|
6
|
+
and pull request diff analysis.
|
7
|
+
|
8
|
+

|
7
9
|
|
8
10
|
Based on [Langchain.js](https://github.com/langchain-ai/langchainjs)
|
9
11
|
|
@@ -12,14 +14,27 @@ Based on [Langchain.js](https://github.com/langchain-ai/langchainjs)
|
|
12
14
|
- Suggests bug fixes;
|
13
15
|
- Explains provided code
|
14
16
|
- Reviews Diffs provided with pipe (|);
|
15
|
-
- You can ask GSloth to review your own code before committing.
|
16
|
-
- Reviews Pull Requests (PRs);
|
17
|
-
- Fetches descriptions (requirements) from Jira
|
17
|
+
- You can ask GSloth to review your own code before committing (`git --no-pager diff | gsloth review`).
|
18
|
+
- Reviews Pull Requests (PRs) (`gsloth pr 42`);
|
19
|
+
- Fetches descriptions (requirements) from Github issue or Jira (`gsloth pr 42 12`);;
|
18
20
|
- Answers questions about provided code;
|
19
21
|
- Writes code;
|
20
|
-
- Saves all responses
|
22
|
+
- Saves all responses in .md file in the project directory;
|
21
23
|
- Anything else you need, when combined with other command line tools.
|
22
24
|
|
25
|
+
## Why?
|
26
|
+
|
27
|
+
While there are many powerful AI assistants available, Gaunt Sloth Assistant stands out by providing developers with:
|
28
|
+
|
29
|
+
1. **Provider flexibility** - Freedom to choose and switch between different AI providers (Google Vertex AI, Anthropic, Groq) based on your specific requirements, performance needs, or compliance policies
|
30
|
+
2. **Open-source transparency** - Complete visibility into how your code and data are processed, with no vendor lock-in
|
31
|
+
3. **Command-line integration** - Seamless workflow integration with existing developer tools and processes
|
32
|
+
4. **Specialized focus** - Purpose-built for code review and PR analysis rather than general-purpose assistance
|
33
|
+
5. **Extensibility** - GSloth is based on LangChain JS and can be easily extended, configured or augmented in different ways.
|
34
|
+
6. **Cost Effectiveness** - When agentic tools will send a number of requests to figure out a user's intent burning thousands of tokens, gsloth simply sends your diff prefixed with guidelines for review.
|
35
|
+
|
36
|
+
Unlike proprietary solutions that restrict you to a single AI provider, Gaunt Sloth empowers developers with choice and control while maintaining the specialized capabilities needed for effective code review.
|
37
|
+
|
23
38
|
### To make GSloth work, you need an **API key** from some AI provider, such as:
|
24
39
|
- Google Vertex AI;
|
25
40
|
- Anthropic;
|
@@ -27,6 +42,8 @@ Based on [Langchain.js](https://github.com/langchain-ai/langchainjs)
|
|
27
42
|
|
28
43
|
## Primary Functions:
|
29
44
|
|
45
|
+
`gth` and `gsloth` commands are used interchangeably, both `gsloth pr 42` and `gth pr 42` do the same thing.
|
46
|
+
|
30
47
|
### Review PR (Pull Request)
|
31
48
|
To review PR by PR number:
|
32
49
|
|
@@ -41,74 +58,43 @@ Type command: `gsloth pr [desired pull request number]`, for example:
|
|
41
58
|
gsloth pr 42
|
42
59
|
```
|
43
60
|
|
44
|
-
Review providing markdown file with requirements and notes.
|
61
|
+
Review PR providing a markdown file with requirements and notes.
|
45
62
|
```shell
|
46
63
|
gsloth pr 42 -f PROJ-1234.md
|
47
64
|
```
|
48
65
|
|
49
|
-
###
|
50
|
-
|
51
|
-
When JIRA integration is configured, the JIRA issue text can be included alongside the diff for review.
|
52
|
-
The project review preamble can be modified to reject a pull request immediately
|
53
|
-
if it appears to implement something different from what was requested in the requirements.
|
66
|
+
### GitHub Issues Integration
|
54
67
|
|
55
|
-
The command syntax is
|
56
|
-
for example, the snippet below does review of PR 42 and
|
57
|
-
supplies description of JIRA issue with number PP-4242:
|
68
|
+
The command syntax is `gsloth pr <prId> [githubIssueId]`. For example, to review PR #42 and include GitHub issue #23 as requirements:
|
58
69
|
|
59
70
|
```shell
|
60
|
-
gsloth pr 42
|
71
|
+
gsloth pr 42 37
|
61
72
|
```
|
62
73
|
|
63
|
-
Gaunt Sloth supports two methods to integrate with JIRA scoped tokens and unscoped tokens:
|
64
|
-
|
65
|
-
#### Modern Jira REST API (Scoped Token)
|
66
|
-
|
67
|
-
This method uses the Atlassian REST API v3 with a Personal Access Token (PAT). It requires your Atlassian Cloud ID.
|
68
|
-
|
69
74
|
**Prerequisites:**
|
70
75
|
|
71
|
-
1.
|
72
|
-
|
73
|
-
2. **Personal Access Token (PAT)**: Create a PAT with the appropriate permissions from `Atlassian Account Settings -> Security -> Create and manage API tokens -> [Create API token with scopes]`.
|
74
|
-
- For issue access, the recommended permission is `read:jira-work` (classic)
|
75
|
-
|
76
|
-
Example configuration:
|
77
|
-
|
78
|
-
```json
|
79
|
-
{
|
80
|
-
"llm": {"type": "vertexai", "model": "gemini-2.5-pro-preview-05-06"},
|
81
|
-
"requirementsProvider": "jira",
|
82
|
-
"requirementsProviderConfig": {
|
83
|
-
"jira": {
|
84
|
-
"username": "username@yourcompany.com",
|
85
|
-
"token": "YOUR_JIRA_PAT_TOKEN",
|
86
|
-
"cloudId": "YOUR_ATLASSIAN_CLOUD_ID"
|
87
|
-
}
|
88
|
-
}
|
89
|
-
}
|
90
|
-
```
|
76
|
+
1. Make sure the official [GitHub CLI (gh)](https://cli.github.com/) is installed and authenticated
|
77
|
+
2. Ensure you have access to the repository's issues
|
91
78
|
|
92
|
-
|
93
|
-
- `JIRA_USERNAME`: Your JIRA username (e.g., `user@yourcompany.com`).
|
94
|
-
- `JIRA_API_PAT_TOKEN`: Your JIRA Personal Access Token with scopes.
|
95
|
-
- `JIRA_CLOUD_ID`: Your Atlassian Cloud ID.
|
79
|
+
No further configuration is needed! Gaunt Sloth will automatically fetch the GitHub issue content using the GitHub CLI.
|
96
80
|
|
97
|
-
|
81
|
+
The project review preamble can be modified to reject a pull request immediately if it appears to implement something different from what was requested in the requirements.
|
98
82
|
|
99
|
-
|
83
|
+
Gaunt Sloth also supports JIRA integration as an alternative requirements provider.
|
84
|
+
For more information on **JIRA** setup and other configuration options, see [CONFIGURATION.md#jira](./docs/CONFIGURATION.md#jira).
|
100
85
|
|
101
86
|
### Review any Diff
|
102
|
-
```shell
|
103
|
-
git --no-pager diff origin/master...yourgitcommithash | gsloth review
|
104
|
-
```
|
105
|
-
(helpful to review a subset of PR)
|
106
87
|
|
107
88
|
Review current local changes:
|
108
89
|
```shell
|
109
90
|
git --no-pager diff | gsloth review
|
110
91
|
```
|
111
92
|
|
93
|
+
```shell
|
94
|
+
git --no-pager diff origin/master...yourgitcommithash | gsloth review
|
95
|
+
```
|
96
|
+
(helpful to review a subset of PR)
|
97
|
+
|
112
98
|
### Question Answering
|
113
99
|
```shell
|
114
100
|
gsloth ask "which types of primitives are available in JavaScript?"
|
Binary file
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# v0.4.0 Add GitHub as Requirements Provider and other improvements
|
2
|
+
|
3
|
+
## New Features
|
4
|
+
|
5
|
+
### GitHub Integration
|
6
|
+
- Added GitHub Issues integration as a default requirements provider
|
7
|
+
- (Breaking change) Renamed 'gh' provider alias to 'github' for consistency
|
8
|
+
- Improved documentation for GitHub integration
|
9
|
+
|
10
|
+
### Enhanced Command Flexibility
|
11
|
+
- Made message argument optional in `ask` command
|
12
|
+
- Added support for reading input from stdin in `ask` command
|
13
|
+
- Added validation to ensure at least one input source is provided (file, stdin, or message)
|
14
|
+
|
15
|
+
## Improvements
|
16
|
+
|
17
|
+
### Configuration
|
18
|
+
- (Potentially breaking change) Updated configuration path structure to use nested 'commands' object
|
19
|
+
- Added comprehensive Configuration Object documentation
|
20
|
+
- Improved configuration validation and error handling
|
21
|
+
|
22
|
+
### Documentation
|
23
|
+
- Added "Why?" section to README explaining the advantages of Gaunt Sloth
|
24
|
+
- Added project logo/banner image
|
25
|
+
- Clarified that both `gth` and `gsloth` commands can be used interchangeably
|
26
|
+
- Reorganized JIRA integration documentation
|
27
|
+
- Enhanced overall presentation and explanation of features
|
28
|
+
- Fixed typos and grammatical errors
|
29
|
+
|
30
|
+
### Development
|
31
|
+
- Added new npm script "it" for running integration tests
|
32
|
+
- Fixed spacing in the "test" script
|
33
|
+
|
34
|
+
## Dependency Updates
|
35
|
+
- Updated @langchain/anthropic from ^0.3.20 to ^0.3.21
|
36
|
+
- Updated eslint-config-prettier from ^9.1.0 to ^10.1.5
|
37
|
+
|
38
|
+
## Bug Fixes
|
39
|
+
- Fixed references to GitHub CLI in the PR command description
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { readBackstory, readGuidelines } from '#src/prompt.js';
|
2
2
|
import { readMultipleFilesFromCurrentDir } from '#src/utils.js';
|
3
3
|
import { initConfig, slothContext } from '#src/config.js';
|
4
|
+
import { getStringFromStdin } from '#src/systemUtils.js';
|
4
5
|
/**
|
5
6
|
* Adds the ask command to the program
|
6
7
|
* @param program - The commander program
|
@@ -9,16 +10,26 @@ export function askCommand(program) {
|
|
9
10
|
program
|
10
11
|
.command('ask')
|
11
12
|
.description('Ask a question')
|
12
|
-
.argument('
|
13
|
+
.argument('[message]', 'A message')
|
13
14
|
.option('-f, --file [files...]', 'Input files. Content of these files will be added BEFORE the message')
|
14
|
-
// TODO add option consuming extra message as argument
|
15
15
|
.action(async (message, options) => {
|
16
16
|
await initConfig();
|
17
17
|
const preamble = [readBackstory(), readGuidelines(slothContext.config.projectGuidelines)];
|
18
|
-
const content = [
|
18
|
+
const content = [];
|
19
19
|
if (options.file) {
|
20
20
|
content.push(readMultipleFilesFromCurrentDir(options.file));
|
21
21
|
}
|
22
|
+
let stringFromStdin = getStringFromStdin();
|
23
|
+
if (stringFromStdin) {
|
24
|
+
content.push(stringFromStdin);
|
25
|
+
}
|
26
|
+
if (message) {
|
27
|
+
content.push(message);
|
28
|
+
}
|
29
|
+
// Validate that at least one input source is provided
|
30
|
+
if (content.length === 0) {
|
31
|
+
throw new Error('At least one of the following is required: file, stdin, or message');
|
32
|
+
}
|
22
33
|
const { askQuestion } = await import('#src/modules/questionAnsweringModule.js');
|
23
34
|
await askQuestion('ASK', preamble.join('\n'), content.join('\n'));
|
24
35
|
});
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"askCommand.js","sourceRoot":"","sources":["../../src/commands/askCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,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AAK,CAAC,oEAAoE,CAAC,CAAC;QACxF,CAAC;QAED,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,MAAM,CAAC,yCAAyC,CAAC,CAAC;QAChF,MAAM,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACP,CAAC"}
|
@@ -5,19 +5,22 @@ import { readMultipleFilesFromCurrentDir } from '#src/utils.js';
|
|
5
5
|
import { displayError } from '#src/consoleUtils.js';
|
6
6
|
import { getStringFromStdin } from '#src/systemUtils.js';
|
7
7
|
/**
|
8
|
-
* Requirements providers. Expected to be in `.providers/` dir
|
8
|
+
* Requirements providers. Expected to be in `.providers/` dir.
|
9
|
+
* Aliases are mapped to actual providers in this file
|
9
10
|
*/
|
10
11
|
const REQUIREMENTS_PROVIDERS = {
|
11
12
|
'jira-legacy': 'jiraIssueLegacyProvider.js',
|
12
13
|
jira: 'jiraIssueProvider.js',
|
14
|
+
github: 'ghIssueProvider.js',
|
13
15
|
text: 'text.js',
|
14
16
|
file: 'file.js',
|
15
17
|
};
|
16
18
|
/**
|
17
|
-
* Content providers. Expected to be in `.providers/` dir
|
19
|
+
* Content providers. Expected to be in `.providers/` dir.
|
20
|
+
* Aliases are mapped to actual providers in this file
|
18
21
|
*/
|
19
22
|
const CONTENT_PROVIDERS = {
|
20
|
-
|
23
|
+
github: 'ghPrDiffProvider.js',
|
21
24
|
text: 'text.js',
|
22
25
|
file: 'file.js',
|
23
26
|
};
|
@@ -45,10 +48,10 @@ export function reviewCommand(program, context) {
|
|
45
48
|
const content = [];
|
46
49
|
const requirementsId = options.requirements;
|
47
50
|
const requirementsProvider = options.requirementsProvider ??
|
48
|
-
context.config?.review?.requirementsProvider ??
|
51
|
+
context.config?.commands?.review?.requirementsProvider ??
|
49
52
|
context.config?.requirementsProvider;
|
50
53
|
const contentProvider = options.contentProvider ??
|
51
|
-
context.config?.review?.contentProvider ??
|
54
|
+
context.config?.commands?.review?.contentProvider ??
|
52
55
|
context.config?.contentProvider;
|
53
56
|
// TODO consider calling these in parallel
|
54
57
|
const requirements = await getRequirementsFromProvider(requirementsProvider, requirementsId);
|
@@ -75,8 +78,8 @@ export function reviewCommand(program, context) {
|
|
75
78
|
program
|
76
79
|
.command('pr')
|
77
80
|
.description('Review provided Pull Request in current directory. ' +
|
78
|
-
'This command is similar to `review`, but default content provider is `
|
79
|
-
'(assuming that
|
81
|
+
'This command is similar to `review`, but default content provider is `github`. ' +
|
82
|
+
'(assuming that GitHub CLI is installed and authenticated for current project')
|
80
83
|
.argument('<prId>', 'Pull request ID to review.')
|
81
84
|
.argument('[requirementsId]', 'Optional requirements ID argument to retrieve requirements with requirements provider')
|
82
85
|
.addOption(new Option('-p, --requirements-provider <requirementsProvider>', 'Requirements provider for this review.').choices(Object.keys(REQUIREMENTS_PROVIDERS)))
|
@@ -91,7 +94,7 @@ export function reviewCommand(program, context) {
|
|
91
94
|
];
|
92
95
|
const content = [];
|
93
96
|
const requirementsProvider = options.requirementsProvider ??
|
94
|
-
context.config?.pr?.requirementsProvider ??
|
97
|
+
context.config?.commands?.pr?.requirementsProvider ??
|
95
98
|
context.config?.requirementsProvider;
|
96
99
|
// Handle requirements
|
97
100
|
const requirements = await getRequirementsFromProvider(requirementsProvider, requirementsId);
|
@@ -101,8 +104,8 @@ export function reviewCommand(program, context) {
|
|
101
104
|
if (options.file) {
|
102
105
|
content.push(readMultipleFilesFromCurrentDir(options.file));
|
103
106
|
}
|
104
|
-
// Get PR diff using the '
|
105
|
-
const providerPath = `#src/providers/${CONTENT_PROVIDERS['
|
107
|
+
// Get PR diff using the 'github' provider
|
108
|
+
const providerPath = `#src/providers/${CONTENT_PROVIDERS['github']}`;
|
106
109
|
const { get } = await import(providerPath);
|
107
110
|
content.push(await get(null, prId));
|
108
111
|
const { review } = await import('#src/modules/reviewModule.js');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"reviewCommand.js","sourceRoot":"","sources":["../../src/commands/reviewCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD
|
1
|
+
{"version":3,"file":"reviewCommand.js","sourceRoot":"","sources":["../../src/commands/reviewCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;GAGG;AACH,MAAM,sBAAsB,GAAG;IAC7B,aAAa,EAAE,4BAA4B;IAC3C,IAAI,EAAE,sBAAsB;IAC5B,MAAM,EAAE,oBAAoB;IAC5B,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;CACP,CAAC;AAIX;;;GAGG;AACH,MAAM,iBAAiB,GAAG;IACxB,MAAM,EAAE,qBAAqB;IAC7B,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;CACP,CAAC;AAiBX,MAAM,UAAU,aAAa,CAAC,OAAgB,EAAE,OAAqB;IACnE,OAAO;SACJ,OAAO,CAAC,QA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;aAAM,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;YAC1C,yCAAyC;YACzC,OAAO,MAAO,QAAwD,CAAC,EAAE,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
CHANGED
@@ -8,6 +8,11 @@ export interface SlothConfig extends BaseSlothConfig {
|
|
8
8
|
commands: {
|
9
9
|
pr: {
|
10
10
|
contentProvider: string;
|
11
|
+
requirementsProvider?: string;
|
12
|
+
};
|
13
|
+
review?: {
|
14
|
+
requirementsProvider?: string;
|
15
|
+
contentProvider?: string;
|
11
16
|
};
|
12
17
|
};
|
13
18
|
}
|
@@ -29,14 +34,12 @@ interface BaseSlothConfig {
|
|
29
34
|
commands?: {
|
30
35
|
pr: {
|
31
36
|
contentProvider: string;
|
37
|
+
requirementsProvider?: string;
|
38
|
+
};
|
39
|
+
review?: {
|
40
|
+
requirementsProvider?: string;
|
41
|
+
contentProvider?: string;
|
32
42
|
};
|
33
|
-
};
|
34
|
-
review?: {
|
35
|
-
requirementsProvider?: string;
|
36
|
-
contentProvider?: string;
|
37
|
-
};
|
38
|
-
pr?: {
|
39
|
-
requirementsProvider?: string;
|
40
43
|
};
|
41
44
|
requirementsProviderConfig?: Record<string, unknown>;
|
42
45
|
contentProviderConfig?: Record<string, unknown>;
|
package/dist/config.js
CHANGED
@@ -19,7 +19,8 @@ export const DEFAULT_CONFIG = {
|
|
19
19
|
projectReviewInstructions: PROJECT_REVIEW_INSTRUCTIONS,
|
20
20
|
commands: {
|
21
21
|
pr: {
|
22
|
-
contentProvider: '
|
22
|
+
contentProvider: 'github', // gh pr diff NN
|
23
|
+
requirementsProvider: 'github', // gh issue view NN
|
23
24
|
},
|
24
25
|
},
|
25
26
|
};
|
@@ -30,7 +31,6 @@ export const DEFAULT_CONFIG = {
|
|
30
31
|
*/
|
31
32
|
export const slothContext = {
|
32
33
|
config: DEFAULT_CONFIG,
|
33
|
-
stdin: '',
|
34
34
|
session: { configurable: { thread_id: uuidv4() } },
|
35
35
|
};
|
36
36
|
export async function initConfig() {
|
package/dist/config.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EAAE,kBAAkB,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAoE1F,MAAM,CAAC,MAAM,sBAAsB,GAAG,mBAAmB,CAAC;AAC1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAG,oBAAoB,CAAC;AAC5D,MAA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M,EAAE,EAAE,EAAE,CAAC;AACnE,CAAC"}
|
@@ -10,7 +10,7 @@ export async function processJsonConfig(llmConfig) {
|
|
10
10
|
return new anthropic.ChatAnthropic({
|
11
11
|
...llmConfig,
|
12
12
|
apiKey: anthropicApiKey,
|
13
|
-
model: llmConfig.model || 'claude-
|
13
|
+
model: llmConfig.model || 'claude-sonnet-4-20250514',
|
14
14
|
});
|
15
15
|
}
|
16
16
|
const jsContent = `/* eslint-disable */
|
@@ -22,7 +22,7 @@ export async function configure(importFunction, global) {
|
|
22
22
|
return {
|
23
23
|
llm: new anthropic.ChatAnthropic({
|
24
24
|
apiKey: process.env.ANTHROPIC_API_KEY, // Default value, but you can provide the key in many different ways, even as literal
|
25
|
-
model: "claude-
|
25
|
+
model: "claude-sonnet-4-20250514" // Don't forget to check new models availability.
|
26
26
|
})
|
27
27
|
};
|
28
28
|
}
|
@@ -30,8 +30,7 @@ export async function configure(importFunction, global) {
|
|
30
30
|
const jsonContent = `{
|
31
31
|
"llm": {
|
32
32
|
"type": "anthropic",
|
33
|
-
"
|
34
|
-
"model": "claude-3-7-sonnet-20250219"
|
33
|
+
"model": "claude-sonnet-4-20250514"
|
35
34
|
}
|
36
35
|
}`;
|
37
36
|
export function init(configFileName) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/configs/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AAOjE,oEAAoE;AACpE,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,SAA+C;IAE/C,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,sBAAsB,CAAC,CAAC;IACvD,wEAAwE;IACxE,MAAM,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AAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC1D,cAAc,CAAC,2BAA2B,cAAc,iCAAiC,CAAC,CAAC;AAC7F,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 provider)
|
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,31 @@
|
|
1
|
+
import { displayWarning } from '#src/consoleUtils.js';
|
2
|
+
import { execAsync } from '#src/utils.js';
|
3
|
+
/**
|
4
|
+
* Gets GitHub issue using GitHub CLI
|
5
|
+
* @param _ config (unused in this provider)
|
6
|
+
* @param issueId GitHub issue number
|
7
|
+
* @returns GitHub issue content or null if not found
|
8
|
+
*/
|
9
|
+
export async function get(_, issueId) {
|
10
|
+
if (!issueId) {
|
11
|
+
displayWarning('No GitHub issue number provided');
|
12
|
+
return null;
|
13
|
+
}
|
14
|
+
try {
|
15
|
+
// Use the GitHub CLI to fetch issue details
|
16
|
+
const issueContent = await execAsync(`gh issue view ${issueId}`);
|
17
|
+
if (!issueContent) {
|
18
|
+
displayWarning(`No content found for GitHub issue #${issueId}`);
|
19
|
+
return null;
|
20
|
+
}
|
21
|
+
return `GitHub Issue: #${issueId}\n\n${issueContent}`;
|
22
|
+
}
|
23
|
+
catch (error) {
|
24
|
+
displayWarning(`
|
25
|
+
Failed to get GitHub issue #${issueId}: ${error instanceof Error ? error.message : String(error)}
|
26
|
+
Consider checking if gh cli (https://cli.github.com/) is installed and authenticated.
|
27
|
+
`);
|
28
|
+
return null;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
//# sourceMappingURL=ghIssueProvider.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ghIssueProvider.js","sourceRoot":"","sources":["../../src/providers/ghIssueProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C;;;;;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,YAAY,GAAG,MAAM,SAAS,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;QAEjE,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"}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { ProviderConfig } from './types.js';
|
2
2
|
/**
|
3
|
-
* Gets PR diff using
|
3
|
+
* Gets PR diff using GitHub CLI
|
4
4
|
* @param _ config (unused in this provider)
|
5
|
-
* @param
|
6
|
-
* @returns PR diff
|
5
|
+
* @param prId GitHub PR number
|
6
|
+
* @returns GitHub PR diff content or null if not found
|
7
7
|
*/
|
8
|
-
export declare function get(_: ProviderConfig | null,
|
8
|
+
export declare function get(_: ProviderConfig | null, prId: string | undefined): Promise<string | null>;
|
@@ -1,16 +1,31 @@
|
|
1
1
|
import { displayWarning } from '#src/consoleUtils.js';
|
2
2
|
import { execAsync } from '#src/utils.js';
|
3
3
|
/**
|
4
|
-
* Gets PR diff using
|
4
|
+
* Gets PR diff using GitHub CLI
|
5
5
|
* @param _ config (unused in this provider)
|
6
|
-
* @param
|
7
|
-
* @returns PR diff
|
6
|
+
* @param prId GitHub PR number
|
7
|
+
* @returns GitHub PR diff content or null if not found
|
8
8
|
*/
|
9
|
-
export async function get(_,
|
10
|
-
if (!
|
11
|
-
displayWarning('No PR provided');
|
9
|
+
export async function get(_, prId) {
|
10
|
+
if (!prId) {
|
11
|
+
displayWarning('No GitHub PR number provided');
|
12
|
+
return null;
|
13
|
+
}
|
14
|
+
try {
|
15
|
+
// Use the GitHub CLI to fetch PR diff
|
16
|
+
const prDiffContent = await execAsync(`gh pr diff ${prId}`);
|
17
|
+
if (!prDiffContent) {
|
18
|
+
displayWarning(`No diff content found for GitHub PR #${prId}`);
|
19
|
+
return null;
|
20
|
+
}
|
21
|
+
return `GitHub PR Diff: #${prId}\n\n${prDiffContent}`;
|
22
|
+
}
|
23
|
+
catch (error) {
|
24
|
+
displayWarning(`
|
25
|
+
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
|
+
`);
|
12
28
|
return null;
|
13
29
|
}
|
14
|
-
return execAsync(`gh pr diff ${pr}`);
|
15
30
|
}
|
16
31
|
//# sourceMappingURL=ghPrDiffProvider.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ghPrDiffProvider.js","sourceRoot":"","sources":["../../src/providers/ghPrDiffProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,CAAwB,EACxB,
|
1
|
+
{"version":3,"file":"ghPrDiffProvider.js","sourceRoot":"","sources":["../../src/providers/ghPrDiffProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,CAAwB,EACxB,IAAwB;IAExB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,cAAc,CAAC,8BAA8B,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,sCAAsC;QACtC,MAAM,aAAa,GAAG,MAAM,SAAS,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;QAE5D,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,cAAc,CAAC,wCAAwC,IAAI,EAAE,CAAC,CAAC;YAC/D,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,oBAAoB,IAAI,OAAO,aAAa,EAAE,CAAC;IACxD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,cAAc,CAAC;gCACa,IAAI,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;;KAE1F,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
|
package/docs/CONFIGURATION.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# Configuration
|
2
2
|
|
3
3
|
Populate `.gsloth.guidelines.md` with your project details and quality requirements.
|
4
|
-
|
4
|
+
A proper preamble is paramount for good inference.
|
5
5
|
Check [.gsloth.guidelines.md](../.gsloth.guidelines.md) for example.
|
6
6
|
|
7
7
|
Your project should have the following files in order for gsloth to function:
|
@@ -35,6 +35,40 @@ If the `.gsloth` directory doesn't exist, gsloth will continue writing all files
|
|
35
35
|
|
36
36
|
**Note:** When initializing a project with an existing `.gsloth` directory, the configuration files will be created in the `.gsloth/.gsloth-settings` directory automatically. There is no automated migration for existing configurations - if you create a `.gsloth` directory after initialization, you'll need to manually move your configuration files into the `.gsloth/.gsloth-settings` directory.
|
37
37
|
|
38
|
+
## Configuration Object
|
39
|
+
|
40
|
+
It is always worth checking sourcecode in [config.ts](../src/config.ts) for more insightful information.
|
41
|
+
|
42
|
+
| Parameter | Required | Default Value | Description |
|
43
|
+
|------------------------------------------|-----------------------------------|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
44
|
+
| `llm` | Required | - | An object configuring LLM. In JS config could be actual instance of LangChainJS [BaseChatModel](https://v03.api.js.langchain.com/classes/_langchain_core.language_models_chat_models.BaseChatModel.html), allowing to use LLMs which do not have a preset. |
|
45
|
+
| `llm.type` | Required (when using JSON config) | - | LLM type or provider. Options currently available are `anthropic`, `groq` and `vertexai`. To use other models supported by LangChainJS, please use JavaScript config. |
|
46
|
+
| `llm.model` | Optional | - | Particular LLM model string (Check in your provider documentation). |
|
47
|
+
| `llm.apiKey` | Optional | - | API key for the LLM provider. You can either use this parameter or use environment variable. |
|
48
|
+
| `contentProvider` | Optional | `file` | Default content provider used to get content for review. Options available are `github`, `file` and `text` (`text` provides text as it is). |
|
49
|
+
| `requirementsProvider` | Optional | `file` | Default requirements provider used to get requirements for review. Options available are `jira`, `jira-legacy`, `github`, `file` and `text`. |
|
50
|
+
| `projectGuidelines` | Optional | `.gsloth.guidelines.md` | Path to the file containing project guidelines. |
|
51
|
+
| `projectReviewInstructions` | Optional | `.gsloth.review.md` | Path to the file containing project review instructions. |
|
52
|
+
| `commands` | Optional | - | Configuration for specific commands. |
|
53
|
+
| `commands.pr` | Optional | - | Configuration for the PR command. |
|
54
|
+
| `commands.pr.contentProvider` | Optional | `github` | Content provider used for PR review (`gsloth pr`). |
|
55
|
+
| `commands.pr.requirementsProvider` | Optional | `github` | Requirements provider used for PR review. If not specified, falls back to the global `requirementsProvider`. |
|
56
|
+
| `commands.review` | Optional | - | Configuration for the review command. |
|
57
|
+
| `commands.review.contentProvider` | Optional | - | Content provider specifically for the review command. If not specified, falls back to the global `contentProvider`. |
|
58
|
+
| `commands.review.requirementsProvider` | Optional | - | Requirements provider specifically for the review command. If not specified, falls back to the global `requirementsProvider`. |
|
59
|
+
| `requirementsProviderConfig` | Optional | - | Configuration for requirements providers. Contains provider-specific configurations. |
|
60
|
+
| `requirementsProviderConfig.jira` | Optional | - | Configuration for the Jira requirements provider (Atlassian REST API v3 with Personal Access Token). |
|
61
|
+
| `requirementsProviderConfig.jira.username` | Optional | - | Jira username (email). Can also be set via JIRA_USERNAME environment variable. |
|
62
|
+
| `requirementsProviderConfig.jira.token` | Optional | - | Jira Personal Access Token. Can also be set via JIRA_API_PAT_TOKEN environment variable. |
|
63
|
+
| `requirementsProviderConfig.jira.cloudId` | Required for `jira` | - | Atlassian Cloud ID. Can also be set via JIRA_CLOUD_ID environment variable. |
|
64
|
+
| `requirementsProviderConfig.jira.displayUrl` | Optional | - | Optional URL for displaying Jira issues (e.g., "https://yourcompany.atlassian.net/browse/"). |
|
65
|
+
| `requirementsProviderConfig.jira-legacy` | Optional | - | Configuration for the Jira Legacy requirements provider (Atlassian REST API v2 with Legacy API Token). |
|
66
|
+
| `requirementsProviderConfig.jira-legacy.username` | Optional | - | Jira username (email). Can also be set via JIRA_USERNAME environment variable. |
|
67
|
+
| `requirementsProviderConfig.jira-legacy.token` | Optional | - | Jira Legacy API Token. Can also be set via JIRA_LEGACY_API_TOKEN environment variable. |
|
68
|
+
| `requirementsProviderConfig.jira-legacy.baseUrl` | Required for `jira-legacy` | - | Base URL for the Jira API (e.g., "https://yourcompany.atlassian.net/rest/api/2/issue/"). |
|
69
|
+
| `requirementsProviderConfig.jira-legacy.displayUrl` | Optional | - | Optional URL for displaying Jira issues (e.g., "https://yourcompany.atlassian.net/browse/"). |
|
70
|
+
| `contentProviderConfig` | Optional | - | Configuration for content providers. Currently, the available content providers (`github`, `file`, and `text`) don't require specific configuration. |
|
71
|
+
|
38
72
|
## Config initialization
|
39
73
|
Configuration can be created with `gsloth init [vendor]` command.
|
40
74
|
Currently, vertexai, anthropic and groq can be configured with `gsloth init [vendor]`.
|
@@ -141,9 +175,7 @@ export async function configure(importFunction, global) {
|
|
141
175
|
}
|
142
176
|
```
|
143
177
|
|
144
|
-
**Example of .gsloth.config.js for Groq**
|
145
|
-
VertexAI usually needs `gcloud auth application-default login`
|
146
|
-
(or both `gcloud auth login` and `gcloud auth application-default login`) and does not need any separate API keys.
|
178
|
+
**Example of .gsloth.config.js for Groq**
|
147
179
|
```javascript
|
148
180
|
export async function configure(importFunction, global) {
|
149
181
|
// this is going to be imported from sloth dependencies,
|
@@ -165,6 +197,46 @@ See [Langchain documentation](https://js.langchain.com/docs/tutorials/llm_chain/
|
|
165
197
|
|
166
198
|
## Content providers
|
167
199
|
|
200
|
+
### GitHub Issues
|
201
|
+
|
202
|
+
Gaunt Sloth supports GitHub issues as a requirements provider using the GitHub CLI. This integration is simple to use and requires minimal setup.
|
203
|
+
|
204
|
+
**Prerequisites:**
|
205
|
+
|
206
|
+
1. **GitHub CLI**: Make sure the official [GitHub CLI (gh)](https://cli.github.com/) is installed and authenticated
|
207
|
+
2. **Repository Access**: Ensure you have access to the repository's issues
|
208
|
+
|
209
|
+
**Usage:**
|
210
|
+
|
211
|
+
The command syntax is `gsloth pr <prId> [githubIssueId]`. For example:
|
212
|
+
|
213
|
+
```shell
|
214
|
+
gsloth pr 42 23
|
215
|
+
```
|
216
|
+
|
217
|
+
This will review PR #42 and include GitHub issue #23 as requirements.
|
218
|
+
|
219
|
+
To explicitly specify the GitHub issue provider:
|
220
|
+
|
221
|
+
```shell
|
222
|
+
gsloth pr 42 23 -p github
|
223
|
+
```
|
224
|
+
|
225
|
+
**Configuration:**
|
226
|
+
|
227
|
+
To set GitHub as your default requirements provider, add this to your configuration file:
|
228
|
+
|
229
|
+
```json
|
230
|
+
{
|
231
|
+
"llm": {"type": "vertexai", "model": "gemini-2.5-pro-preview-05-06"},
|
232
|
+
"commands": {
|
233
|
+
"pr": {
|
234
|
+
"requirementsProvider": "github"
|
235
|
+
}
|
236
|
+
}
|
237
|
+
}
|
238
|
+
```
|
239
|
+
|
168
240
|
### JIRA
|
169
241
|
|
170
242
|
Gaunt Sloth supports two methods to integrate with JIRA:
|
package/docs/DEVELOPMENT.md
CHANGED
@@ -11,8 +11,7 @@ npm install -g ./
|
|
11
11
|
```
|
12
12
|
## Testing
|
13
13
|
|
14
|
-
Unit tests are implemented with [
|
15
|
-
and [testdouble.js](https://github.com/testdouble/testdouble.js).
|
14
|
+
Unit tests are implemented with [Vitest](https://vitest.dev/).
|
16
15
|
|
17
16
|
Running unit tests:
|
18
17
|
|
package/docs/RELEASE-HOWTO.md
CHANGED
package/eslint.config.js
CHANGED
@@ -76,7 +76,7 @@ export default defineConfig([
|
|
76
76
|
},
|
77
77
|
// Test TypeScript files with separate project reference
|
78
78
|
{
|
79
|
-
files: ['spec/**/*.ts', 'vitest.config.ts'],
|
79
|
+
files: ['spec/**/*.ts', 'integration-tests/**/*.ts', 'vitest.config.ts', 'vitest-it.config.ts'],
|
80
80
|
languageOptions: {
|
81
81
|
parser: tsParser,
|
82
82
|
parserOptions: {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "gaunt-sloth-assistant",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.4.0",
|
4
4
|
"description": "",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Andrew Kondratev",
|
@@ -13,7 +13,8 @@
|
|
13
13
|
},
|
14
14
|
"scripts": {
|
15
15
|
"build": "tsc",
|
16
|
-
"test": "npm run build &&vitest run",
|
16
|
+
"test": "npm run build && vitest run",
|
17
|
+
"it": "npm run build && vitest run --config vitest-it.config.ts",
|
17
18
|
"lint": "eslint . --ext .js,.ts",
|
18
19
|
"format": "prettier --write 'src/**/*.{js,ts}'",
|
19
20
|
"prepare": "npm run build"
|
@@ -23,7 +24,7 @@
|
|
23
24
|
"gth": "index.js"
|
24
25
|
},
|
25
26
|
"dependencies": {
|
26
|
-
"@langchain/anthropic": "^0.3.
|
27
|
+
"@langchain/anthropic": "^0.3.21",
|
27
28
|
"@langchain/core": "^0.3.55",
|
28
29
|
"@langchain/google-vertexai": "^0.2.8",
|
29
30
|
"@langchain/groq": "^0.2.2",
|
@@ -39,7 +40,7 @@
|
|
39
40
|
"@typescript-eslint/eslint-plugin": "^8.32.0",
|
40
41
|
"@typescript-eslint/parser": "^8.32.0",
|
41
42
|
"eslint": "^9.26.0",
|
42
|
-
"eslint-config-prettier": "^
|
43
|
+
"eslint-config-prettier": "^10.1.5",
|
43
44
|
"eslint-plugin-prettier": "^5.1.3",
|
44
45
|
"globals": "^16.1.0",
|
45
46
|
"prettier": "3.5.3",
|
@@ -2,6 +2,7 @@ import { Command } from 'commander';
|
|
2
2
|
import { readBackstory, readGuidelines } from '#src/prompt.js';
|
3
3
|
import { readMultipleFilesFromCurrentDir } from '#src/utils.js';
|
4
4
|
import { initConfig, slothContext } from '#src/config.js';
|
5
|
+
import { getStringFromStdin } from '#src/systemUtils.js';
|
5
6
|
|
6
7
|
interface AskCommandOptions {
|
7
8
|
file?: string[];
|
@@ -15,19 +16,31 @@ export function askCommand(program: Command): void {
|
|
15
16
|
program
|
16
17
|
.command('ask')
|
17
18
|
.description('Ask a question')
|
18
|
-
.argument('
|
19
|
+
.argument('[message]', 'A message')
|
19
20
|
.option(
|
20
21
|
'-f, --file [files...]',
|
21
22
|
'Input files. Content of these files will be added BEFORE the message'
|
22
23
|
)
|
23
|
-
// TODO add option consuming extra message as argument
|
24
24
|
.action(async (message: string, options: AskCommandOptions) => {
|
25
25
|
await initConfig();
|
26
26
|
const preamble = [readBackstory(), readGuidelines(slothContext.config.projectGuidelines)];
|
27
|
-
const content = [
|
27
|
+
const content = [];
|
28
28
|
if (options.file) {
|
29
29
|
content.push(readMultipleFilesFromCurrentDir(options.file));
|
30
30
|
}
|
31
|
+
let stringFromStdin = getStringFromStdin();
|
32
|
+
if (stringFromStdin) {
|
33
|
+
content.push(stringFromStdin);
|
34
|
+
}
|
35
|
+
if (message) {
|
36
|
+
content.push(message);
|
37
|
+
}
|
38
|
+
|
39
|
+
// Validate that at least one input source is provided
|
40
|
+
if (content.length === 0) {
|
41
|
+
throw new Error('At least one of the following is required: file, stdin, or message');
|
42
|
+
}
|
43
|
+
|
31
44
|
const { askQuestion } = await import('#src/modules/questionAnsweringModule.js');
|
32
45
|
await askQuestion('ASK', preamble.join('\n'), content.join('\n'));
|
33
46
|
});
|
@@ -7,11 +7,13 @@ import { displayError } from '#src/consoleUtils.js';
|
|
7
7
|
import { getStringFromStdin } from '#src/systemUtils.js';
|
8
8
|
|
9
9
|
/**
|
10
|
-
* Requirements providers. Expected to be in `.providers/` dir
|
10
|
+
* Requirements providers. Expected to be in `.providers/` dir.
|
11
|
+
* Aliases are mapped to actual providers in this file
|
11
12
|
*/
|
12
13
|
const REQUIREMENTS_PROVIDERS = {
|
13
14
|
'jira-legacy': 'jiraIssueLegacyProvider.js',
|
14
15
|
jira: 'jiraIssueProvider.js',
|
16
|
+
github: 'ghIssueProvider.js',
|
15
17
|
text: 'text.js',
|
16
18
|
file: 'file.js',
|
17
19
|
} as const;
|
@@ -19,10 +21,11 @@ const REQUIREMENTS_PROVIDERS = {
|
|
19
21
|
type RequirementsProviderType = keyof typeof REQUIREMENTS_PROVIDERS;
|
20
22
|
|
21
23
|
/**
|
22
|
-
* Content providers. Expected to be in `.providers/` dir
|
24
|
+
* Content providers. Expected to be in `.providers/` dir.
|
25
|
+
* Aliases are mapped to actual providers in this file
|
23
26
|
*/
|
24
27
|
const CONTENT_PROVIDERS = {
|
25
|
-
|
28
|
+
github: 'ghPrDiffProvider.js',
|
26
29
|
text: 'text.js',
|
27
30
|
file: 'file.js',
|
28
31
|
} as const;
|
@@ -82,11 +85,13 @@ export function reviewCommand(program: Command, context: SlothContext): void {
|
|
82
85
|
const requirementsId = options.requirements;
|
83
86
|
const requirementsProvider =
|
84
87
|
options.requirementsProvider ??
|
85
|
-
(context.config?.review?.requirementsProvider as
|
88
|
+
(context.config?.commands?.review?.requirementsProvider as
|
89
|
+
| RequirementsProviderType
|
90
|
+
| undefined) ??
|
86
91
|
(context.config?.requirementsProvider as RequirementsProviderType | undefined);
|
87
92
|
const contentProvider =
|
88
93
|
options.contentProvider ??
|
89
|
-
(context.config?.review?.contentProvider as ContentProviderType | undefined) ??
|
94
|
+
(context.config?.commands?.review?.contentProvider as ContentProviderType | undefined) ??
|
90
95
|
(context.config?.contentProvider as ContentProviderType | undefined);
|
91
96
|
|
92
97
|
// TODO consider calling these in parallel
|
@@ -118,8 +123,8 @@ export function reviewCommand(program: Command, context: SlothContext): void {
|
|
118
123
|
.command('pr')
|
119
124
|
.description(
|
120
125
|
'Review provided Pull Request in current directory. ' +
|
121
|
-
'This command is similar to `review`, but default content provider is `
|
122
|
-
'(assuming that
|
126
|
+
'This command is similar to `review`, but default content provider is `github`. ' +
|
127
|
+
'(assuming that GitHub CLI is installed and authenticated for current project'
|
123
128
|
)
|
124
129
|
.argument('<prId>', 'Pull request ID to review.')
|
125
130
|
.argument(
|
@@ -148,7 +153,9 @@ export function reviewCommand(program: Command, context: SlothContext): void {
|
|
148
153
|
const content: string[] = [];
|
149
154
|
const requirementsProvider =
|
150
155
|
options.requirementsProvider ??
|
151
|
-
(context.config?.pr?.requirementsProvider as
|
156
|
+
(context.config?.commands?.pr?.requirementsProvider as
|
157
|
+
| RequirementsProviderType
|
158
|
+
| undefined) ??
|
152
159
|
(context.config?.requirementsProvider as RequirementsProviderType | undefined);
|
153
160
|
|
154
161
|
// Handle requirements
|
@@ -161,8 +168,8 @@ export function reviewCommand(program: Command, context: SlothContext): void {
|
|
161
168
|
content.push(readMultipleFilesFromCurrentDir(options.file));
|
162
169
|
}
|
163
170
|
|
164
|
-
// Get PR diff using the '
|
165
|
-
const providerPath = `#src/providers/${CONTENT_PROVIDERS['
|
171
|
+
// Get PR diff using the 'github' provider
|
172
|
+
const providerPath = `#src/providers/${CONTENT_PROVIDERS['github']}`;
|
166
173
|
const { get } = await import(providerPath);
|
167
174
|
content.push(await get(null, prId));
|
168
175
|
|
package/src/config.ts
CHANGED
@@ -15,6 +15,11 @@ export interface SlothConfig extends BaseSlothConfig {
|
|
15
15
|
commands: {
|
16
16
|
pr: {
|
17
17
|
contentProvider: string;
|
18
|
+
requirementsProvider?: string;
|
19
|
+
};
|
20
|
+
review?: {
|
21
|
+
requirementsProvider?: string;
|
22
|
+
contentProvider?: string;
|
18
23
|
};
|
19
24
|
};
|
20
25
|
}
|
@@ -38,14 +43,12 @@ interface BaseSlothConfig {
|
|
38
43
|
commands?: {
|
39
44
|
pr: {
|
40
45
|
contentProvider: string;
|
46
|
+
requirementsProvider?: string;
|
47
|
+
};
|
48
|
+
review?: {
|
49
|
+
requirementsProvider?: string;
|
50
|
+
contentProvider?: string;
|
41
51
|
};
|
42
|
-
};
|
43
|
-
review?: {
|
44
|
-
requirementsProvider?: string;
|
45
|
-
contentProvider?: string;
|
46
|
-
};
|
47
|
-
pr?: {
|
48
|
-
requirementsProvider?: string;
|
49
52
|
};
|
50
53
|
requirementsProviderConfig?: Record<string, unknown>;
|
51
54
|
contentProviderConfig?: Record<string, unknown>;
|
@@ -87,7 +90,8 @@ export const DEFAULT_CONFIG: Partial<SlothConfig> = {
|
|
87
90
|
projectReviewInstructions: PROJECT_REVIEW_INSTRUCTIONS,
|
88
91
|
commands: {
|
89
92
|
pr: {
|
90
|
-
contentProvider: '
|
93
|
+
contentProvider: 'github', // gh pr diff NN
|
94
|
+
requirementsProvider: 'github', // gh issue view NN
|
91
95
|
},
|
92
96
|
},
|
93
97
|
};
|
@@ -99,7 +103,6 @@ export const DEFAULT_CONFIG: Partial<SlothConfig> = {
|
|
99
103
|
*/
|
100
104
|
export const slothContext = {
|
101
105
|
config: DEFAULT_CONFIG,
|
102
|
-
stdin: '',
|
103
106
|
session: { configurable: { thread_id: uuidv4() } },
|
104
107
|
} as Partial<SlothContext> as SlothContext;
|
105
108
|
|
package/src/configs/anthropic.ts
CHANGED
@@ -18,7 +18,7 @@ export async function processJsonConfig(
|
|
18
18
|
return new anthropic.ChatAnthropic({
|
19
19
|
...llmConfig,
|
20
20
|
apiKey: anthropicApiKey,
|
21
|
-
model: llmConfig.model || 'claude-
|
21
|
+
model: llmConfig.model || 'claude-sonnet-4-20250514',
|
22
22
|
});
|
23
23
|
}
|
24
24
|
|
@@ -31,7 +31,7 @@ export async function configure(importFunction, global) {
|
|
31
31
|
return {
|
32
32
|
llm: new anthropic.ChatAnthropic({
|
33
33
|
apiKey: process.env.ANTHROPIC_API_KEY, // Default value, but you can provide the key in many different ways, even as literal
|
34
|
-
model: "claude-
|
34
|
+
model: "claude-sonnet-4-20250514" // Don't forget to check new models availability.
|
35
35
|
})
|
36
36
|
};
|
37
37
|
}
|
@@ -40,8 +40,7 @@ export async function configure(importFunction, global) {
|
|
40
40
|
const jsonContent = `{
|
41
41
|
"llm": {
|
42
42
|
"type": "anthropic",
|
43
|
-
"
|
44
|
-
"model": "claude-3-7-sonnet-20250219"
|
43
|
+
"model": "claude-sonnet-4-20250514"
|
45
44
|
}
|
46
45
|
}`;
|
47
46
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { displayWarning } from '#src/consoleUtils.js';
|
2
|
+
import { execAsync } from '#src/utils.js';
|
3
|
+
import type { ProviderConfig } from './types.js';
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Gets GitHub issue using GitHub CLI
|
7
|
+
* @param _ config (unused in this provider)
|
8
|
+
* @param issueId GitHub issue number
|
9
|
+
* @returns GitHub issue content or null if not found
|
10
|
+
*/
|
11
|
+
export async function get(
|
12
|
+
_: ProviderConfig | null,
|
13
|
+
issueId: string | undefined
|
14
|
+
): Promise<string | null> {
|
15
|
+
if (!issueId) {
|
16
|
+
displayWarning('No GitHub issue number provided');
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
|
20
|
+
try {
|
21
|
+
// Use the GitHub CLI to fetch issue details
|
22
|
+
const issueContent = await execAsync(`gh issue view ${issueId}`);
|
23
|
+
|
24
|
+
if (!issueContent) {
|
25
|
+
displayWarning(`No content found for GitHub issue #${issueId}`);
|
26
|
+
return null;
|
27
|
+
}
|
28
|
+
|
29
|
+
return `GitHub Issue: #${issueId}\n\n${issueContent}`;
|
30
|
+
} catch (error) {
|
31
|
+
displayWarning(`
|
32
|
+
Failed to get GitHub issue #${issueId}: ${error instanceof Error ? error.message : String(error)}
|
33
|
+
Consider checking if gh cli (https://cli.github.com/) is installed and authenticated.
|
34
|
+
`);
|
35
|
+
return null;
|
36
|
+
}
|
37
|
+
}
|
@@ -3,18 +3,35 @@ import { execAsync } from '#src/utils.js';
|
|
3
3
|
import type { ProviderConfig } from './types.js';
|
4
4
|
|
5
5
|
/**
|
6
|
-
* Gets PR diff using
|
6
|
+
* Gets PR diff using GitHub CLI
|
7
7
|
* @param _ config (unused in this provider)
|
8
|
-
* @param
|
9
|
-
* @returns PR diff
|
8
|
+
* @param prId GitHub PR number
|
9
|
+
* @returns GitHub PR diff content or null if not found
|
10
10
|
*/
|
11
11
|
export async function get(
|
12
12
|
_: ProviderConfig | null,
|
13
|
-
|
13
|
+
prId: string | undefined
|
14
14
|
): Promise<string | null> {
|
15
|
-
if (!
|
16
|
-
displayWarning('No PR provided');
|
15
|
+
if (!prId) {
|
16
|
+
displayWarning('No GitHub PR number provided');
|
17
|
+
return null;
|
18
|
+
}
|
19
|
+
|
20
|
+
try {
|
21
|
+
// Use the GitHub CLI to fetch PR diff
|
22
|
+
const prDiffContent = await execAsync(`gh pr diff ${prId}`);
|
23
|
+
|
24
|
+
if (!prDiffContent) {
|
25
|
+
displayWarning(`No diff content found for GitHub PR #${prId}`);
|
26
|
+
return null;
|
27
|
+
}
|
28
|
+
|
29
|
+
return `GitHub PR Diff: #${prId}\n\n${prDiffContent}`;
|
30
|
+
} catch (error) {
|
31
|
+
displayWarning(`
|
32
|
+
Failed to get GitHub PR diff #${prId}: ${error instanceof Error ? error.message : String(error)}
|
33
|
+
Consider checking if gh cli (https://cli.github.com/) is installed and authenticated.
|
34
|
+
`);
|
17
35
|
return null;
|
18
36
|
}
|
19
|
-
return execAsync(`gh pr diff ${pr}`);
|
20
37
|
}
|
package/tsconfig.json
CHANGED
@@ -0,0 +1,14 @@
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
2
|
+
|
3
|
+
export default defineConfig({
|
4
|
+
test: {
|
5
|
+
include: ['integration-tests/**/*.it.ts'],
|
6
|
+
environment: 'node',
|
7
|
+
coverage: {
|
8
|
+
provider: 'v8',
|
9
|
+
reporter: ['text', 'json', 'html'],
|
10
|
+
},
|
11
|
+
globals: true,
|
12
|
+
testTimeout: 100000,
|
13
|
+
},
|
14
|
+
});
|