gaunt-sloth-assistant 0.4.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +15 -0
- package/.gsloth.backstory.md +0 -0
- package/.gsloth.guidelines.md +0 -0
- package/.gsloth.review.md +0 -0
- package/.gsloth.system.md +10 -0
- package/.prettierrc.json +0 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +0 -0
- package/README.md +11 -1
- package/ROADMAP.md +0 -0
- package/assets/gaunt-sloth-logo.png +0 -0
- package/assets/release-notes/v0_4_0.md +0 -0
- package/assets/release-notes/v0_5_0.md +10 -0
- package/assets/release-notes/v0_5_1.md +47 -0
- package/dist/commands/askCommand.d.ts +0 -0
- package/dist/commands/askCommand.js +9 -5
- package/dist/commands/askCommand.js.map +1 -1
- package/dist/commands/commandUtils.d.ts +25 -0
- package/dist/commands/commandUtils.js +48 -0
- package/dist/commands/commandUtils.js.map +1 -0
- package/dist/commands/initCommand.d.ts +0 -0
- package/dist/commands/initCommand.js +0 -0
- package/dist/commands/initCommand.js.map +0 -0
- package/dist/commands/prCommand.d.ts +2 -0
- package/dist/commands/prCommand.js +52 -0
- package/dist/commands/prCommand.js.map +1 -0
- package/dist/commands/reviewCommand.d.ts +1 -2
- package/dist/commands/reviewCommand.js +17 -98
- package/dist/commands/reviewCommand.js.map +1 -1
- package/dist/config.d.ts +22 -41
- package/dist/config.js +107 -88
- package/dist/config.js.map +1 -1
- package/dist/configs/anthropic.d.ts +0 -0
- package/dist/configs/anthropic.js +0 -0
- package/dist/configs/anthropic.js.map +0 -0
- package/dist/configs/fake.d.ts +0 -0
- package/dist/configs/fake.js +0 -0
- package/dist/configs/fake.js.map +0 -0
- package/dist/configs/groq.d.ts +0 -0
- package/dist/configs/groq.js +0 -0
- package/dist/configs/groq.js.map +0 -0
- package/dist/configs/vertexai.d.ts +0 -0
- package/dist/configs/vertexai.js +0 -0
- package/dist/configs/vertexai.js.map +0 -0
- package/dist/consoleUtils.d.ts +0 -0
- package/dist/consoleUtils.js +0 -0
- package/dist/consoleUtils.js.map +0 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.js +8 -0
- package/dist/constants.js.map +1 -0
- package/dist/filePathUtils.d.ts +0 -0
- package/dist/filePathUtils.js +0 -0
- package/dist/filePathUtils.js.map +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/llmUtils.d.ts +2 -2
- package/dist/llmUtils.js +128 -28
- package/dist/llmUtils.js.map +1 -1
- package/dist/modules/questionAnsweringModule.d.ts +2 -1
- package/dist/modules/questionAnsweringModule.js +7 -8
- package/dist/modules/questionAnsweringModule.js.map +1 -1
- package/dist/modules/reviewModule.d.ts +2 -1
- package/dist/modules/reviewModule.js +7 -11
- package/dist/modules/reviewModule.js.map +1 -1
- package/dist/modules/types.d.ts +0 -0
- package/dist/modules/types.js +0 -0
- package/dist/modules/types.js.map +0 -0
- package/dist/prompt.d.ts +1 -0
- package/dist/prompt.js +4 -1
- package/dist/prompt.js.map +1 -1
- package/dist/providers/file.d.ts +0 -0
- package/dist/providers/file.js +0 -0
- package/dist/providers/file.js.map +0 -0
- package/dist/providers/ghIssueProvider.d.ts +0 -0
- package/dist/providers/ghIssueProvider.js +3 -1
- package/dist/providers/ghIssueProvider.js.map +1 -1
- package/dist/providers/ghPrDiffProvider.d.ts +0 -0
- package/dist/providers/ghPrDiffProvider.js +3 -1
- package/dist/providers/ghPrDiffProvider.js.map +1 -1
- package/dist/providers/jiraIssueLegacyProvider.d.ts +0 -0
- package/dist/providers/jiraIssueLegacyProvider.js +0 -0
- package/dist/providers/jiraIssueLegacyProvider.js.map +0 -0
- package/dist/providers/jiraIssueProvider.d.ts +0 -0
- package/dist/providers/jiraIssueProvider.js +3 -1
- package/dist/providers/jiraIssueProvider.js.map +1 -1
- package/dist/providers/text.d.ts +0 -0
- package/dist/providers/text.js +0 -0
- package/dist/providers/text.js.map +0 -0
- package/dist/providers/types.d.ts +0 -0
- package/dist/providers/types.js +0 -0
- package/dist/providers/types.js.map +0 -0
- package/dist/systemUtils.d.ts +0 -0
- package/dist/systemUtils.js +0 -0
- package/dist/systemUtils.js.map +0 -0
- package/dist/utils.d.ts +0 -0
- package/dist/utils.js +0 -0
- package/dist/utils.js.map +0 -0
- package/docs/CONFIGURATION.md +60 -26
- package/docs/DEVELOPMENT.md +0 -0
- package/docs/RELEASE-HOWTO.md +0 -0
- package/eslint.config.js +0 -0
- package/maintenance/doc-maintenance.md +0 -0
- package/package.json +11 -7
- package/src/commands/askCommand.ts +9 -5
- package/src/commands/commandUtils.ts +77 -0
- package/src/commands/initCommand.ts +0 -0
- package/src/commands/prCommand.ts +93 -0
- package/src/commands/reviewCommand.ts +33 -155
- package/src/config.ts +128 -128
- package/src/configs/anthropic.ts +0 -0
- package/src/configs/fake.ts +0 -0
- package/src/configs/groq.ts +0 -0
- package/src/configs/vertexai.ts +0 -0
- package/src/consoleUtils.ts +0 -0
- package/src/constants.ts +7 -0
- package/src/filePathUtils.ts +0 -0
- package/src/index.ts +4 -2
- package/src/llmUtils.ts +149 -36
- package/src/modules/questionAnsweringModule.ts +9 -13
- package/src/modules/reviewModule.ts +14 -11
- package/src/modules/types.ts +0 -0
- package/src/prompt.ts +5 -1
- package/src/providers/file.ts +0 -0
- package/src/providers/ghIssueProvider.ts +3 -1
- package/src/providers/ghPrDiffProvider.ts +3 -1
- package/src/providers/jiraIssueLegacyProvider.ts +0 -0
- package/src/providers/jiraIssueProvider.ts +5 -1
- package/src/providers/text.ts +0 -0
- package/src/providers/types.ts +0 -0
- package/src/systemUtils.ts +0 -0
- package/src/utils.ts +0 -0
- package/tsconfig.json +0 -0
- package/vitest-it.config.ts +0 -0
- package/vitest.config.ts +0 -0
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"permissions": {
|
3
|
+
"allow": [
|
4
|
+
"Bash(npm test:*)",
|
5
|
+
"Bash(npm run test:*)",
|
6
|
+
"Bash(grep:*)",
|
7
|
+
"Bash(npm run lint)",
|
8
|
+
"Bash(npm run lint:*)",
|
9
|
+
"Bash(npm run build:*)",
|
10
|
+
"Bash(npx vitest run:*)",
|
11
|
+
"Bash(node:*)"
|
12
|
+
],
|
13
|
+
"deny": []
|
14
|
+
}
|
15
|
+
}
|
package/.gsloth.backstory.md
CHANGED
File without changes
|
package/.gsloth.guidelines.md
CHANGED
File without changes
|
package/.gsloth.review.md
CHANGED
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Filesystem Context
|
2
|
+
|
3
|
+
When the user mentions directories and files without specifying an exact location, this is likely referring to files in the current working directory (`.`).
|
4
|
+
|
5
|
+
For example:
|
6
|
+
- "Read the config file" likely means a configuration file in the current directory
|
7
|
+
- "Check the tests" likely refers to test files in the current project
|
8
|
+
- "Look at the source code" typically means source files in the current directory structure
|
9
|
+
|
10
|
+
Always consider the current working directory as the default context for file operations unless the user specifies an absolute path or different location.
|
package/.prettierrc.json
CHANGED
File without changes
|
package/CLAUDE.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Refer to .gsloth.guidelines.md for project guidelines.
|
package/LICENSE
CHANGED
File without changes
|
package/README.md
CHANGED
@@ -31,7 +31,8 @@ While there are many powerful AI assistants available, Gaunt Sloth Assistant sta
|
|
31
31
|
3. **Command-line integration** - Seamless workflow integration with existing developer tools and processes
|
32
32
|
4. **Specialized focus** - Purpose-built for code review and PR analysis rather than general-purpose assistance
|
33
33
|
5. **Extensibility** - GSloth is based on LangChain JS and can be easily extended, configured or augmented in different ways.
|
34
|
-
6. **
|
34
|
+
6. **Model Context Protocol (MCP)** - Support for MCP allows for enhanced context management.
|
35
|
+
7. **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
|
|
36
37
|
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
38
|
|
@@ -54,6 +55,11 @@ Open terminal (command line) in your project directory.
|
|
54
55
|
|
55
56
|
Type command: `gsloth pr [desired pull request number]`, for example:
|
56
57
|
|
58
|
+
Please note that for higher quality code reviews sloth now has read access and may read files in the current project,
|
59
|
+
this means that the branch of reviewed PR should be checked out, otherwise Sloth might get confused.
|
60
|
+
If you are typically review PRs without checking them out and looking at diff only is enough,
|
61
|
+
consider setting pr.filesystem to 'none' in your config.
|
62
|
+
|
57
63
|
```shell
|
58
64
|
gsloth pr 42
|
59
65
|
```
|
@@ -156,6 +162,10 @@ Make sure you either define `GROQ_API_KEY` environment variable or edit your con
|
|
156
162
|
### Other AI providers
|
157
163
|
Any other AI provider supported by Langchain.js can be configured with js [Config](./docs/CONFIGURATION.md).
|
158
164
|
|
165
|
+
## Contributing
|
166
|
+
Contributors are needed! Feel free to create a PR.
|
167
|
+
If you are not sure where to start, look for issues with a "good first issue" label.
|
168
|
+
|
159
169
|
## Building from repo
|
160
170
|
See [DEVELOPMENT.md](./docs/DEVELOPMENT.md)
|
161
171
|
|
package/ROADMAP.md
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# v0.5.0 Add MCP support
|
2
|
+
|
3
|
+
## New Features
|
4
|
+
|
5
|
+
### Model Context Protocol (MCP) Support
|
6
|
+
- Added support for Model Context Protocol (MCP) for enhanced context management
|
7
|
+
- Included `@modelcontextprotocol/server-filesystem` as a dependency
|
8
|
+
- Added configuration options for MCP servers in `.gsloth.config.json`
|
9
|
+
|
10
|
+
Use at your own risk. Not super-well-tested yet.
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# v0.5.1 File Read Aaccess Enabled By Default
|
2
|
+
|
3
|
+
## New Feature
|
4
|
+
|
5
|
+
The main feature for this release is file system access available by default.
|
6
|
+
Gaunt Sloth now able to read files in your repository.
|
7
|
+
|
8
|
+
### Filesystem Configuration
|
9
|
+
- Added filesystem access controls with granular permissions
|
10
|
+
- Options include: `'all'`, `'none'`, or specific file patterns, only read only operations enabled by default.
|
11
|
+
- Command-specific filesystem settings for enhanced security
|
12
|
+
- Default readonly filesystem settings for safer operations
|
13
|
+
|
14
|
+
## Bug Fixes
|
15
|
+
|
16
|
+
### Anthropic Streaming Fix
|
17
|
+
- Fixed streaming issues with Anthropic provider by disabling streaming when problematic
|
18
|
+
- Added helpful warning messages when streaming is automatically disabled
|
19
|
+
|
20
|
+
### Configuration Fixes
|
21
|
+
- Fixed system prompt handling bug
|
22
|
+
- Resolved configuration loading issues
|
23
|
+
- Fixed failing GitHub integration tests
|
24
|
+
|
25
|
+
## Improvements
|
26
|
+
|
27
|
+
### Progress Indicators
|
28
|
+
- Added progress indicators to GitHub providers for better indication
|
29
|
+
|
30
|
+
### Configuration Refactoring
|
31
|
+
- Major refactoring of config system removing "slothContext"
|
32
|
+
- Improved config type definitions and validation
|
33
|
+
|
34
|
+
### Enhanced Testing
|
35
|
+
- Provider-specific integration test configurations for Anthropic, Groq, and VertexAI
|
36
|
+
|
37
|
+
### Package Updates
|
38
|
+
- Updated `@langchain/langgraph` (0.2.71 → 0.3.1)
|
39
|
+
- Updated `@langchain/mcp-adapters` (0.4.5 → 0.5.2)
|
40
|
+
- Updated TypeScript ESLint packages
|
41
|
+
- Updated Vitest (3.1.3 → 3.2.2)
|
42
|
+
- Updated other dependencies
|
43
|
+
|
44
|
+
### Documentation
|
45
|
+
- Updated README with important notes about PR review workflow
|
46
|
+
- Added contributing notes
|
47
|
+
- Improved integration test documentation
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import { readBackstory, readGuidelines } from '#src/prompt.js';
|
1
|
+
import { readBackstory, readGuidelines, readSystemPrompt } from '#src/prompt.js';
|
2
2
|
import { readMultipleFilesFromCurrentDir } from '#src/utils.js';
|
3
|
-
import { initConfig
|
3
|
+
import { initConfig } from '#src/config.js';
|
4
4
|
import { getStringFromStdin } from '#src/systemUtils.js';
|
5
5
|
/**
|
6
6
|
* Adds the ask command to the program
|
@@ -13,8 +13,12 @@ export function askCommand(program) {
|
|
13
13
|
.argument('[message]', 'A message')
|
14
14
|
.option('-f, --file [files...]', 'Input files. Content of these files will be added BEFORE the message')
|
15
15
|
.action(async (message, options) => {
|
16
|
-
await initConfig();
|
17
|
-
const
|
16
|
+
const config = await initConfig();
|
17
|
+
const systemPrompt = readSystemPrompt();
|
18
|
+
const preamble = [readBackstory(), readGuidelines(config.projectGuidelines)];
|
19
|
+
if (systemPrompt) {
|
20
|
+
preamble.push(systemPrompt);
|
21
|
+
}
|
18
22
|
const content = [];
|
19
23
|
if (options.file) {
|
20
24
|
content.push(readMultipleFilesFromCurrentDir(options.file));
|
@@ -31,7 +35,7 @@ export function askCommand(program) {
|
|
31
35
|
throw new Error('At least one of the following is required: file, stdin, or message');
|
32
36
|
}
|
33
37
|
const { askQuestion } = await import('#src/modules/questionAnsweringModule.js');
|
34
|
-
await askQuestion('ASK', preamble.join('\n'), content.join('\n'));
|
38
|
+
await askQuestion('ASK', preamble.join('\n'), content.join('\n'), config);
|
35
39
|
});
|
36
40
|
}
|
37
41
|
//# sourceMappingURL=askCommand.js.map
|
@@ -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;
|
1
|
+
{"version":3,"file":"askCommand.js","sourceRoot":"","sources":["../../src/commands/askCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAMzD;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAAgB;IACzC,OA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C,CAAC;IAC5E,CAAC,CAAC,CAAC;AACP,CAAC"}
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import type { SlothConfig } from '#src/config.js';
|
2
|
+
/**
|
3
|
+
* Requirements providers. Expected to be in `.providers/` dir.
|
4
|
+
* Aliases are mapped to actual providers in this file
|
5
|
+
*/
|
6
|
+
export declare const REQUIREMENTS_PROVIDERS: {
|
7
|
+
readonly 'jira-legacy': "jiraIssueLegacyProvider.js";
|
8
|
+
readonly jira: "jiraIssueProvider.js";
|
9
|
+
readonly github: "ghIssueProvider.js";
|
10
|
+
readonly text: "text.js";
|
11
|
+
readonly file: "file.js";
|
12
|
+
};
|
13
|
+
export type RequirementsProviderType = keyof typeof REQUIREMENTS_PROVIDERS;
|
14
|
+
/**
|
15
|
+
* Content providers. Expected to be in `.providers/` dir.
|
16
|
+
* Aliases are mapped to actual providers in this file
|
17
|
+
*/
|
18
|
+
export declare const CONTENT_PROVIDERS: {
|
19
|
+
readonly github: "ghPrDiffProvider.js";
|
20
|
+
readonly text: "text.js";
|
21
|
+
readonly file: "file.js";
|
22
|
+
};
|
23
|
+
export type ContentProviderType = keyof typeof CONTENT_PROVIDERS;
|
24
|
+
export declare function getRequirementsFromProvider(requirementsProvider: RequirementsProviderType | undefined, requirementsId: string | undefined, config: SlothConfig): Promise<string>;
|
25
|
+
export declare function getContentFromProvider(contentProvider: ContentProviderType | undefined, contentId: string | undefined, config: SlothConfig): Promise<string>;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
import { displayError } from '#src/consoleUtils.js';
|
2
|
+
/**
|
3
|
+
* Requirements providers. Expected to be in `.providers/` dir.
|
4
|
+
* Aliases are mapped to actual providers in this file
|
5
|
+
*/
|
6
|
+
export const REQUIREMENTS_PROVIDERS = {
|
7
|
+
'jira-legacy': 'jiraIssueLegacyProvider.js',
|
8
|
+
jira: 'jiraIssueProvider.js',
|
9
|
+
github: 'ghIssueProvider.js',
|
10
|
+
text: 'text.js',
|
11
|
+
file: 'file.js',
|
12
|
+
};
|
13
|
+
/**
|
14
|
+
* Content providers. Expected to be in `.providers/` dir.
|
15
|
+
* Aliases are mapped to actual providers in this file
|
16
|
+
*/
|
17
|
+
export const CONTENT_PROVIDERS = {
|
18
|
+
github: 'ghPrDiffProvider.js',
|
19
|
+
text: 'text.js',
|
20
|
+
file: 'file.js',
|
21
|
+
};
|
22
|
+
export async function getRequirementsFromProvider(requirementsProvider, requirementsId, config) {
|
23
|
+
return getFromProvider(requirementsProvider, requirementsId, (config?.requirementsProviderConfig ?? {})[requirementsProvider], REQUIREMENTS_PROVIDERS);
|
24
|
+
}
|
25
|
+
export async function getContentFromProvider(contentProvider, contentId, config) {
|
26
|
+
return getFromProvider(contentProvider, contentId, (config?.contentProviderConfig ?? {})[contentProvider], CONTENT_PROVIDERS);
|
27
|
+
}
|
28
|
+
async function getFromProvider(provider, id,
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
30
|
+
config, legitPredefinedProviders) {
|
31
|
+
if (typeof provider === 'string') {
|
32
|
+
// Use one of the predefined providers
|
33
|
+
if (legitPredefinedProviders[provider]) {
|
34
|
+
const providerPath = `#src/providers/${legitPredefinedProviders[provider]}`;
|
35
|
+
const { get } = await import(providerPath);
|
36
|
+
return await get(config, id);
|
37
|
+
}
|
38
|
+
else {
|
39
|
+
displayError(`Unknown provider: ${provider}. Continuing without it.`);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
else if (typeof provider === 'function') {
|
43
|
+
// Type assertion to handle function call
|
44
|
+
return await provider(id);
|
45
|
+
}
|
46
|
+
return '';
|
47
|
+
}
|
48
|
+
//# sourceMappingURL=commandUtils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"commandUtils.js","sourceRoot":"","sources":["../../src/commands/commandUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,a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xE,CAAC;IACH,CAAC;SAAM,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QAC1C,yCAAyC;QACzC,OAAO,MAAO,QAAwD,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import { Option } from 'commander';
|
2
|
+
import { readBackstory, readGuidelines, readReviewInstructions, readSystemPrompt, } from '#src/prompt.js';
|
3
|
+
import { readMultipleFilesFromCurrentDir } from '#src/utils.js';
|
4
|
+
import { REQUIREMENTS_PROVIDERS, CONTENT_PROVIDERS, getRequirementsFromProvider, } from './commandUtils.js';
|
5
|
+
export function prCommand(program) {
|
6
|
+
program
|
7
|
+
.command('pr')
|
8
|
+
.description('Review provided Pull Request in current directory. ' +
|
9
|
+
'This command is similar to `review`, but default content provider is `github`. ' +
|
10
|
+
'(assuming that GitHub CLI is installed and authenticated for current project')
|
11
|
+
.argument('<prId>', 'Pull request ID to review.')
|
12
|
+
.argument('[requirementsId]', 'Optional requirements ID argument to retrieve requirements with requirements provider')
|
13
|
+
.addOption(new Option('-p, --requirements-provider <requirementsProvider>', 'Requirements provider for this review.').choices(Object.keys(REQUIREMENTS_PROVIDERS)))
|
14
|
+
.option('-f, --file [files...]', 'Input files. Content of these files will be added BEFORE the diff, but after requirements')
|
15
|
+
.action(async (prId, requirementsId, options) => {
|
16
|
+
const { initConfig } = await import('#src/config.js');
|
17
|
+
const config = await initConfig(); // Initialize and get config
|
18
|
+
const systemPrompt = readSystemPrompt();
|
19
|
+
const systemMessage = [
|
20
|
+
readBackstory(),
|
21
|
+
readGuidelines(config.projectGuidelines),
|
22
|
+
readReviewInstructions(config.projectReviewInstructions),
|
23
|
+
];
|
24
|
+
if (systemPrompt) {
|
25
|
+
systemMessage.push(systemPrompt);
|
26
|
+
}
|
27
|
+
const content = [];
|
28
|
+
const requirementsProvider = options.requirementsProvider ??
|
29
|
+
config?.commands?.pr?.requirementsProvider ??
|
30
|
+
config?.requirementsProvider;
|
31
|
+
const contentProvider = config?.commands?.pr?.contentProvider ??
|
32
|
+
config?.contentProvider ??
|
33
|
+
'github';
|
34
|
+
// Handle requirements
|
35
|
+
const requirements = await getRequirementsFromProvider(requirementsProvider, requirementsId, config);
|
36
|
+
if (requirements) {
|
37
|
+
content.push(requirements);
|
38
|
+
}
|
39
|
+
if (options.file) {
|
40
|
+
content.push(readMultipleFilesFromCurrentDir(options.file));
|
41
|
+
}
|
42
|
+
// Get PR diff using the provider
|
43
|
+
const providerPath = `#src/providers/${CONTENT_PROVIDERS[contentProvider]}`;
|
44
|
+
const { get } = await import(providerPath);
|
45
|
+
content.push(await get(null, prId));
|
46
|
+
const { review } = await import('#src/modules/reviewModule.js');
|
47
|
+
// TODO consider including requirements id
|
48
|
+
// TODO sanitize prId
|
49
|
+
await review(`PR-${prId}`, systemMessage.join('\n'), content.join('\n'), config, 'pr');
|
50
|
+
});
|
51
|
+
}
|
52
|
+
//# sourceMappingURL=prCommand.js.map
|
@@ -0,0 +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,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EAEjB,2BAA2B,GAE5B,MAAM,mBAAmB,CAAC;AAO3B,MAAM,UAAU,SAAS,CAAC,OAAgB;IACxC,OAAO;SACJ,OAAO,CAAC,IAAI,CAAC;SACb,WAAW,CACV,qDAAqD;QACnD,iFAAiF;QACjF,8EAA8E,CACjF;SACA,QAAQ,CAAC,QAAQ,EAAE,4BAA4B,CAAC;SAChD,QAAQ,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AC,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,CAAC;QAED,iCAAiC;QACjC,MAAM,YAAY,GAAG,kBAAkB,iBAAiB,CAAC,eAAe,CAAC,EAAE,CAAC;QAC5E,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QAC3C,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QAEpC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;QAChE,0CAA0C;QAC1C,qBAAqB;QACrB,MAAM,MAAM,CAAC,MAAM,IAAI,EAAE,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACzF,CAAC,CAAC,CAAC;AACP,CAAC"}
|
@@ -1,30 +1,9 @@
|
|
1
1
|
import { Option } from 'commander';
|
2
|
-
import {
|
3
|
-
import { readBackstory, readGuidelines, readReviewInstructions } from '#src/prompt.js';
|
2
|
+
import { readBackstory, readGuidelines, readReviewInstructions, readSystemPrompt, } from '#src/prompt.js';
|
4
3
|
import { readMultipleFilesFromCurrentDir } from '#src/utils.js';
|
5
|
-
import { displayError } from '#src/consoleUtils.js';
|
6
4
|
import { getStringFromStdin } from '#src/systemUtils.js';
|
7
|
-
|
8
|
-
|
9
|
-
* Aliases are mapped to actual providers in this file
|
10
|
-
*/
|
11
|
-
const REQUIREMENTS_PROVIDERS = {
|
12
|
-
'jira-legacy': 'jiraIssueLegacyProvider.js',
|
13
|
-
jira: 'jiraIssueProvider.js',
|
14
|
-
github: 'ghIssueProvider.js',
|
15
|
-
text: 'text.js',
|
16
|
-
file: 'file.js',
|
17
|
-
};
|
18
|
-
/**
|
19
|
-
* Content providers. Expected to be in `.providers/` dir.
|
20
|
-
* Aliases are mapped to actual providers in this file
|
21
|
-
*/
|
22
|
-
const CONTENT_PROVIDERS = {
|
23
|
-
github: 'ghPrDiffProvider.js',
|
24
|
-
text: 'text.js',
|
25
|
-
file: 'file.js',
|
26
|
-
};
|
27
|
-
export function reviewCommand(program, context) {
|
5
|
+
import { REQUIREMENTS_PROVIDERS, CONTENT_PROVIDERS, getRequirementsFromProvider, getContentFromProvider, } from './commandUtils.js';
|
6
|
+
export function reviewCommand(program) {
|
28
7
|
program
|
29
8
|
.command('review')
|
30
9
|
.description('Review provided diff or other content')
|
@@ -39,26 +18,30 @@ export function reviewCommand(program, context) {
|
|
39
18
|
.option('-m, --message <message>', 'Extra message to provide just before the content')
|
40
19
|
.action(async (contentId, options) => {
|
41
20
|
const { initConfig } = await import('#src/config.js');
|
42
|
-
await initConfig();
|
21
|
+
const config = await initConfig(); // Initialize and get config
|
22
|
+
const systemPrompt = readSystemPrompt();
|
43
23
|
const systemMessage = [
|
44
24
|
readBackstory(),
|
45
|
-
readGuidelines(
|
46
|
-
readReviewInstructions(
|
25
|
+
readGuidelines(config.projectGuidelines),
|
26
|
+
readReviewInstructions(config.projectReviewInstructions),
|
47
27
|
];
|
28
|
+
if (systemPrompt) {
|
29
|
+
systemMessage.push(systemPrompt);
|
30
|
+
}
|
48
31
|
const content = [];
|
49
32
|
const requirementsId = options.requirements;
|
50
33
|
const requirementsProvider = options.requirementsProvider ??
|
51
|
-
|
52
|
-
|
34
|
+
config?.commands?.review?.requirementsProvider ??
|
35
|
+
config?.requirementsProvider;
|
53
36
|
const contentProvider = options.contentProvider ??
|
54
|
-
|
55
|
-
|
37
|
+
config?.commands?.review?.contentProvider ??
|
38
|
+
config?.contentProvider;
|
56
39
|
// TODO consider calling these in parallel
|
57
|
-
const requirements = await getRequirementsFromProvider(requirementsProvider, requirementsId);
|
40
|
+
const requirements = await getRequirementsFromProvider(requirementsProvider, requirementsId, config);
|
58
41
|
if (requirements) {
|
59
42
|
content.push(requirements);
|
60
43
|
}
|
61
|
-
const providedContent = await getContentFromProvider(contentProvider, contentId);
|
44
|
+
const providedContent = await getContentFromProvider(contentProvider, contentId, config);
|
62
45
|
if (providedContent) {
|
63
46
|
content.push(providedContent);
|
64
47
|
}
|
@@ -73,71 +56,7 @@ export function reviewCommand(program, context) {
|
|
73
56
|
content.push(options.message);
|
74
57
|
}
|
75
58
|
const { review } = await import('#src/modules/reviewModule.js');
|
76
|
-
await review('REVIEW', systemMessage.join('\n'), content.join('\n'));
|
77
|
-
});
|
78
|
-
program
|
79
|
-
.command('pr')
|
80
|
-
.description('Review provided Pull Request in current directory. ' +
|
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')
|
83
|
-
.argument('<prId>', 'Pull request ID to review.')
|
84
|
-
.argument('[requirementsId]', 'Optional requirements ID argument to retrieve requirements with requirements provider')
|
85
|
-
.addOption(new Option('-p, --requirements-provider <requirementsProvider>', 'Requirements provider for this review.').choices(Object.keys(REQUIREMENTS_PROVIDERS)))
|
86
|
-
.option('-f, --file [files...]', 'Input files. Content of these files will be added BEFORE the diff, but after requirements')
|
87
|
-
.action(async (prId, requirementsId, options) => {
|
88
|
-
const { initConfig } = await import('#src/config.js');
|
89
|
-
await initConfig();
|
90
|
-
const systemMessage = [
|
91
|
-
readBackstory(),
|
92
|
-
readGuidelines(slothContext.config.projectGuidelines),
|
93
|
-
readReviewInstructions(slothContext.config.projectReviewInstructions),
|
94
|
-
];
|
95
|
-
const content = [];
|
96
|
-
const requirementsProvider = options.requirementsProvider ??
|
97
|
-
context.config?.commands?.pr?.requirementsProvider ??
|
98
|
-
context.config?.requirementsProvider;
|
99
|
-
// Handle requirements
|
100
|
-
const requirements = await getRequirementsFromProvider(requirementsProvider, requirementsId);
|
101
|
-
if (requirements) {
|
102
|
-
content.push(requirements);
|
103
|
-
}
|
104
|
-
if (options.file) {
|
105
|
-
content.push(readMultipleFilesFromCurrentDir(options.file));
|
106
|
-
}
|
107
|
-
// Get PR diff using the 'github' provider
|
108
|
-
const providerPath = `#src/providers/${CONTENT_PROVIDERS['github']}`;
|
109
|
-
const { get } = await import(providerPath);
|
110
|
-
content.push(await get(null, prId));
|
111
|
-
const { review } = await import('#src/modules/reviewModule.js');
|
112
|
-
// TODO consider including requirements id
|
113
|
-
// TODO sanitize prId
|
114
|
-
await review(`PR-${prId}`, systemMessage.join('\n'), content.join('\n'));
|
59
|
+
await review('REVIEW', systemMessage.join('\n'), content.join('\n'), config);
|
115
60
|
});
|
116
|
-
async function getRequirementsFromProvider(requirementsProvider, requirementsId) {
|
117
|
-
return getFromProvider(requirementsProvider, requirementsId, (context.config?.requirementsProviderConfig ?? {})[requirementsProvider], REQUIREMENTS_PROVIDERS);
|
118
|
-
}
|
119
|
-
async function getContentFromProvider(contentProvider, contentId) {
|
120
|
-
return getFromProvider(contentProvider, contentId, (context.config?.contentProviderConfig ?? {})[contentProvider], CONTENT_PROVIDERS);
|
121
|
-
}
|
122
|
-
async function getFromProvider(provider, id,
|
123
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
124
|
-
config, legitPredefinedProviders) {
|
125
|
-
if (typeof provider === 'string') {
|
126
|
-
// Use one of the predefined providers
|
127
|
-
if (legitPredefinedProviders[provider]) {
|
128
|
-
const providerPath = `#src/providers/${legitPredefinedProviders[provider]}`;
|
129
|
-
const { get } = await import(providerPath);
|
130
|
-
return await get(config, id);
|
131
|
-
}
|
132
|
-
else {
|
133
|
-
displayError(`Unknown provider: ${provider}. Continuing without it.`);
|
134
|
-
}
|
135
|
-
}
|
136
|
-
else if (typeof provider === 'function') {
|
137
|
-
// Type assertion to handle function call
|
138
|
-
return await provider(id);
|
139
|
-
}
|
140
|
-
return '';
|
141
|
-
}
|
142
61
|
}
|
143
62
|
//# sourceMappingURL=reviewCommand.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"reviewCommand.js","sourceRoot":"","sources":["../../src/commands/reviewCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;
|
1
|
+
{"version":3,"file":"reviewCommand.js","sourceRoot":"","sources":["../../src/commands/reviewCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EAGjB,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAU3B,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CAAC,uCAAuC,CAAC;SACpD,QAAQ,CACP,aAAa,EACb,wEAAwE,CACzE;SACA,KAAK,CAAC,GAAG,CAAC;QACX,0DAA0D;SACzD,MAAM,CACL,uBAAuB,EACvB,2FAA2F,CAC5F;QACD,2FAA2F;SAC1F,MAAM,CAAC,mCAAmC,EAAE,+BAA+B,CAAC;SAC5E,SAAS,CACR,IAAI,MAAM,CACR,oDAAoD,EACpD,wCAAwC,CACzC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAC/C;SACA,SAAS,CACR,IAAI,MAAM,CAAC,sCAAsC,EAAE,mBAAmB,CAAC,CAAC,OAAO,CAC7E,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAC/B,CACF;SACA,MAAM,CAAC,yBAAyB,EAAE,kDAAkD,CAAC;SACrF,MAAM,CAAC,KAAK,EAAE,SAA6B,EAAE,OAA6B,EAAE,EAAE;QAC7E,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CA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AE,CAAC;QAC3C,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAChC,CAAC;QACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;QACD,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,8BAA8B,CAAC,CAAC;QAChE,MAAM,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/dist/config.d.ts
CHANGED
@@ -1,20 +1,13 @@
|
|
1
1
|
import type { BaseChatModel } from '@langchain/core/language_models/chat_models';
|
2
|
+
import type { Connection } from '@langchain/mcp-adapters';
|
2
3
|
export interface SlothConfig extends BaseSlothConfig {
|
3
4
|
llm: BaseChatModel;
|
4
5
|
contentProvider: string;
|
5
6
|
requirementsProvider: string;
|
6
7
|
projectGuidelines: string;
|
7
8
|
projectReviewInstructions: string;
|
8
|
-
|
9
|
-
|
10
|
-
contentProvider: string;
|
11
|
-
requirementsProvider?: string;
|
12
|
-
};
|
13
|
-
review?: {
|
14
|
-
requirementsProvider?: string;
|
15
|
-
contentProvider?: string;
|
16
|
-
};
|
17
|
-
};
|
9
|
+
streamOutput: boolean;
|
10
|
+
filesystem: string[] | 'all' | 'none';
|
18
11
|
}
|
19
12
|
/**
|
20
13
|
* Raw, unprocessed sloth config
|
@@ -31,57 +24,45 @@ interface BaseSlothConfig {
|
|
31
24
|
requirementsProvider?: string;
|
32
25
|
projectGuidelines?: string;
|
33
26
|
projectReviewInstructions?: string;
|
27
|
+
streamOutput?: boolean;
|
28
|
+
filesystem?: string[] | 'all' | 'none';
|
34
29
|
commands?: {
|
35
|
-
pr
|
36
|
-
contentProvider
|
30
|
+
pr?: {
|
31
|
+
contentProvider?: string;
|
37
32
|
requirementsProvider?: string;
|
33
|
+
filesystem?: string[] | 'all' | 'none';
|
38
34
|
};
|
39
35
|
review?: {
|
40
36
|
requirementsProvider?: string;
|
41
37
|
contentProvider?: string;
|
38
|
+
filesystem?: string[] | 'all' | 'none';
|
39
|
+
};
|
40
|
+
ask?: {
|
41
|
+
filesystem?: string[] | 'all' | 'none';
|
42
42
|
};
|
43
43
|
};
|
44
44
|
requirementsProviderConfig?: Record<string, unknown>;
|
45
45
|
contentProviderConfig?: Record<string, unknown>;
|
46
|
-
|
47
|
-
/**
|
48
|
-
* @deprecated
|
49
|
-
* this object has blurred responsibility lines and bad name.
|
50
|
-
*/
|
51
|
-
export interface SlothContext {
|
52
|
-
config: SlothConfig;
|
53
|
-
session: {
|
54
|
-
configurable: {
|
55
|
-
thread_id: string;
|
56
|
-
};
|
57
|
-
};
|
46
|
+
mcpServers?: Record<string, Connection>;
|
58
47
|
}
|
59
48
|
export interface LLMConfig extends Record<string, unknown> {
|
60
49
|
type: string;
|
61
50
|
model: string;
|
62
51
|
}
|
63
|
-
export declare const USER_PROJECT_CONFIG_JS = ".gsloth.config.js";
|
64
|
-
export declare const USER_PROJECT_CONFIG_JSON = ".gsloth.config.json";
|
65
|
-
export declare const USER_PROJECT_CONFIG_MJS = ".gsloth.config.mjs";
|
66
|
-
export declare const GSLOTH_BACKSTORY = ".gsloth.backstory.md";
|
67
|
-
export declare const PROJECT_GUIDELINES = ".gsloth.guidelines.md";
|
68
|
-
export declare const PROJECT_REVIEW_INSTRUCTIONS = ".gsloth.review.md";
|
69
52
|
export declare const availableDefaultConfigs: readonly ["vertexai", "anthropic", "groq"];
|
70
53
|
export type ConfigType = (typeof availableDefaultConfigs)[number];
|
71
54
|
export declare const DEFAULT_CONFIG: Partial<SlothConfig>;
|
72
55
|
/**
|
73
|
-
*
|
74
|
-
*
|
75
|
-
* TODO this should be reworked to something more robust
|
56
|
+
* Initialize configuration by loading from available config files
|
57
|
+
* @returns The loaded SlothConfig
|
76
58
|
*/
|
77
|
-
export declare
|
78
|
-
export declare function initConfig(): Promise<void>;
|
79
|
-
export declare function tryJsonConfig(jsonConfig: RawSlothConfig): Promise<void>;
|
80
|
-
export declare function createProjectConfig(configType: string): Promise<void>;
|
81
|
-
export declare function writeProjectReviewPreamble(): void;
|
59
|
+
export declare function initConfig(): Promise<SlothConfig>;
|
82
60
|
/**
|
83
|
-
*
|
84
|
-
*
|
61
|
+
* Process JSON LLM config by creating the appropriate LLM instance
|
62
|
+
* @param jsonConfig - The parsed JSON config
|
63
|
+
* @returns Promise<SlothConfig>
|
85
64
|
*/
|
86
|
-
export declare function
|
65
|
+
export declare function tryJsonConfig(jsonConfig: RawSlothConfig): Promise<SlothConfig>;
|
66
|
+
export declare function createProjectConfig(configType: string): Promise<void>;
|
67
|
+
export declare function writeProjectReviewPreamble(): void;
|
87
68
|
export {};
|