gaunt-sloth-assistant 0.7.1 → 0.7.3
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.config_.json +7 -0
- package/.gsloth.config_.mjs +15 -0
- package/.gsloth.config_claude.mjs +18 -0
- package/.gsloth.config_vertex.json +6 -0
- package/README.md +162 -153
- package/assets/release-notes/v0_7_2.md +14 -0
- package/assets/release-notes/v0_7_3.md +64 -0
- package/dist/builtInToolsConfig.d.ts +6 -0
- package/dist/builtInToolsConfig.js +73 -0
- package/dist/builtInToolsConfig.js.map +1 -0
- package/dist/commands/prCommand.js +14 -1
- package/dist/commands/prCommand.js.map +1 -1
- package/dist/config.d.ts +19 -8
- package/dist/config.js +4 -44
- package/dist/config.js.map +1 -1
- package/dist/core/Invocation.js +5 -2
- package/dist/core/Invocation.js.map +1 -1
- package/dist/helpers/jira/jiraClient.d.ts +4 -0
- package/dist/helpers/jira/jiraClient.js +75 -0
- package/dist/helpers/jira/jiraClient.js.map +1 -0
- package/dist/helpers/jira/jiraLogWork.d.ts +2 -0
- package/dist/helpers/jira/jiraLogWork.js +53 -0
- package/dist/helpers/jira/jiraLogWork.js.map +1 -0
- package/dist/{configs → presets}/anthropic.js +2 -1
- package/dist/{configs → presets}/anthropic.js.map +1 -1
- package/dist/presets/deepseek.d.ts +4 -0
- package/dist/presets/deepseek.js +33 -0
- package/dist/presets/deepseek.js.map +1 -0
- package/dist/{configs → presets}/fake.js.map +1 -1
- package/dist/{configs → presets}/groq.js +4 -5
- package/dist/presets/groq.js.map +1 -0
- package/dist/{configs → presets}/vertexai.js +2 -3
- package/dist/presets/vertexai.js.map +1 -0
- package/dist/providers/jiraIssueProvider.js +9 -52
- package/dist/providers/jiraIssueProvider.js.map +1 -1
- package/dist/tools/gthJiraLogWorkTool.d.ts +3 -0
- package/dist/tools/gthJiraLogWorkTool.js +37 -0
- package/dist/tools/gthJiraLogWorkTool.js.map +1 -0
- package/dist/tools/gthStatusUpdateTool.d.ts +2 -0
- package/dist/tools/gthStatusUpdateTool.js +16 -0
- package/dist/tools/gthStatusUpdateTool.js.map +1 -0
- package/docs/CONFIGURATION.md +468 -437
- package/docs/DEVELOPMENT.md +26 -0
- package/it.js +15 -0
- package/package.json +13 -14
- package/src/builtInToolsConfig.ts +99 -0
- package/src/commands/prCommand.ts +28 -3
- package/src/config.ts +23 -65
- package/src/core/Invocation.ts +7 -2
- package/src/helpers/jira/jiraClient.ts +99 -0
- package/src/helpers/jira/jiraLogWork.ts +81 -0
- package/src/{configs → presets}/anthropic.ts +4 -1
- package/src/presets/deepseek.ts +46 -0
- package/src/{configs → presets}/groq.ts +5 -6
- package/src/{configs → presets}/vertexai.ts +2 -3
- package/src/providers/jiraIssueProvider.ts +13 -70
- package/src/tools/gthJiraLogWorkTool.ts +51 -0
- package/src/tools/gthStatusUpdateTool.ts +18 -0
- package/vitest-it.config.ts +1 -1
- package/vitest.config.ts +1 -0
- package/dist/configs/groq.js.map +0 -1
- package/dist/configs/vertexai.js.map +0 -1
- package/dist/core/AgentInterface.d.ts +0 -36
- package/dist/core/AgentInterface.js +0 -2
- package/dist/core/AgentInterface.js.map +0 -1
- package/dist/core/HuggingFaceAgentWrapper.d.ts +0 -20
- package/dist/core/HuggingFaceAgentWrapper.js +0 -148
- package/dist/core/HuggingFaceAgentWrapper.js.map +0 -1
- package/dist/core/LangChainAgentWrapper.d.ts +0 -17
- package/dist/core/LangChainAgentWrapper.js +0 -70
- package/dist/core/LangChainAgentWrapper.js.map +0 -1
- package/dist/tools/statusUpdate.d.ts +0 -1
- package/dist/tools/statusUpdate.js +0 -12
- package/dist/tools/statusUpdate.js.map +0 -1
- package/examples/huggingface/gth_2025-06-29_01-11-51_ASK.md +0 -1
- package/examples/huggingface/gth_2025-06-29_01-17-11_CHAT.md +0 -16
- package/src/tools/statusUpdate.ts +0 -15
- /package/dist/{configs → presets}/anthropic.d.ts +0 -0
- /package/dist/{configs → presets}/fake.d.ts +0 -0
- /package/dist/{configs → presets}/fake.js +0 -0
- /package/dist/{configs → presets}/groq.d.ts +0 -0
- /package/dist/{configs → presets}/vertexai.d.ts +0 -0
- /package/src/{configs → presets}/fake.ts +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { statusUpdate } from './dist/tools/statusUpdate.js';
|
|
2
|
+
import GthFileSystemToolkit from './dist/tools/GthFileSystemToolkit.js';
|
|
3
|
+
|
|
4
|
+
export async function configure() {
|
|
5
|
+
const deepseek = await import('@langchain/deepseek');
|
|
6
|
+
return {
|
|
7
|
+
llm: new deepseek.ChatDeepSeek({
|
|
8
|
+
model: 'deepseek-reasoner',
|
|
9
|
+
}),
|
|
10
|
+
tools: [
|
|
11
|
+
statusUpdate,
|
|
12
|
+
new GthFileSystemToolkit()
|
|
13
|
+
]
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export async function configure() {
|
|
2
|
+
const { ChatAnthropic } = await import('@langchain/anthropic');
|
|
3
|
+
|
|
4
|
+
const model = new ChatAnthropic({
|
|
5
|
+
model: 'claude-sonnet-4-20250514',
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
return {
|
|
9
|
+
llm: model,
|
|
10
|
+
tools: [
|
|
11
|
+
{
|
|
12
|
+
type: 'web_search_20250305',
|
|
13
|
+
name: 'web_search',
|
|
14
|
+
max_uses: 10,
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
}
|
package/README.md
CHANGED
|
@@ -1,153 +1,162 @@
|
|
|
1
|
-
# Gaunt Sloth Assistant
|
|
2
|
-
[](https://github.com/andruhon/gaunt-sloth-assistant/actions/workflows/ci.yml)
|
|
3
|
-
|
|
4
|
-
Gaunt GSloth Assistant is a lightweight **command line AI assistant**
|
|
5
|
-
built with TypeScript (JavaScript) and distributed via NPM with minimum dependencies.
|
|
6
|
-
|
|
7
|
-

|
|
8
|
-
|
|
9
|
-
Based on [LangChain.js](https://github.com/langchain-ai/langchainjs)
|
|
10
|
-
|
|
11
|
-
## Why?
|
|
12
|
-
|
|
13
|
-
There are many Open Source command line AI assistants available, such as Aider and Goose;
|
|
14
|
-
there are great non-open source options such as Claude Code.
|
|
15
|
-
|
|
16
|
-
Gaunt Sloth does not intend to be your "Daily Driver" and is not aiming to replace your Cursor.
|
|
17
|
-
What it promises is that it is small, extendable, cross-platform and can itself be a dependency in your project.
|
|
18
|
-
|
|
19
|
-
The GSloth was initially built as a code review tool, fetching PR contents and Jira contents before feeding them to
|
|
20
|
-
the LLM, but we ourselves found many more use cases which we initially did not anticipate; for example,
|
|
21
|
-
we may have it as a dependency in an MCP project, allowing us to quickly spin it up to simulate or test some use cases.
|
|
22
|
-
|
|
23
|
-
The promise of Gaunt Sloth:
|
|
24
|
-
|
|
25
|
-
- **Minimum dependencies**. Ideally, we aim to only have CommanderJS and some packages from LangChainJS and LangGraphJS.
|
|
26
|
-
- **Extensibility**. Feel free to write some JS and create your Tool, Provider or connect to the MCP server of your choice.
|
|
27
|
-
- **No vendor lock-in**. Just BYO API keys.
|
|
28
|
-
- **Easy installation via NPM**.
|
|
29
|
-
- **All prompts are editable** via markdown files.
|
|
30
|
-
- **No UI**. Command Line only, with intent to be used as a dependency, potentially in your build pipeline.
|
|
31
|
-
Of course, you can use Gaunt Sloth as a dependency and hook your own UI.
|
|
32
|
-
|
|
33
|
-
## What GSloth does:
|
|
34
|
-
|
|
35
|
-
- Reviews code;
|
|
36
|
-
- Suggests bug fixes;
|
|
37
|
-
- Explains provided code
|
|
38
|
-
- Reviews Diffs provided with pipe (|);
|
|
39
|
-
- You can ask GSloth to review your own code before committing (`git --no-pager diff | gsloth review`).
|
|
40
|
-
- Reviews Pull Requests (PRs) (`gsloth pr 42`);
|
|
41
|
-
- Fetches descriptions (requirements) from Github issue or Jira (`gsloth pr 42 12`);;
|
|
42
|
-
- Answers questions about provided code;
|
|
43
|
-
- Writes code;
|
|
44
|
-
- Connects to MCP server;
|
|
45
|
-
- Saves all responses in .md file in the project directory;
|
|
46
|
-
- Anything else you need, when combined with other command line tools.
|
|
47
|
-
|
|
48
|
-
### To make GSloth work, you need an **API key** from some AI provider, such as:
|
|
49
|
-
|
|
50
|
-
- Google Vertex AI;
|
|
51
|
-
- Anthropic;
|
|
52
|
-
- Groq
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- **`
|
|
66
|
-
- **`
|
|
67
|
-
- **`
|
|
68
|
-
- **`
|
|
69
|
-
- **`
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
gsloth
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
>
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
gcloud auth
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
1
|
+
# Gaunt Sloth Assistant
|
|
2
|
+
[](https://github.com/andruhon/gaunt-sloth-assistant/actions/workflows/ci.yml) [](https://github.com/andruhon/gaunt-sloth-assistant/actions/workflows/it.yml)
|
|
3
|
+
|
|
4
|
+
Gaunt GSloth Assistant is a lightweight **command line AI assistant**
|
|
5
|
+
built with TypeScript (JavaScript) and distributed via NPM with minimum dependencies.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
Based on [LangChain.js](https://github.com/langchain-ai/langchainjs)
|
|
10
|
+
|
|
11
|
+
## Why?
|
|
12
|
+
|
|
13
|
+
There are many Open Source command line AI assistants available, such as Aider and Goose;
|
|
14
|
+
there are great non-open source options such as Claude Code.
|
|
15
|
+
|
|
16
|
+
Gaunt Sloth does not intend to be your "Daily Driver" and is not aiming to replace your Cursor.
|
|
17
|
+
What it promises is that it is small, extendable, cross-platform and can itself be a dependency in your project.
|
|
18
|
+
|
|
19
|
+
The GSloth was initially built as a code review tool, fetching PR contents and Jira contents before feeding them to
|
|
20
|
+
the LLM, but we ourselves found many more use cases which we initially did not anticipate; for example,
|
|
21
|
+
we may have it as a dependency in an MCP project, allowing us to quickly spin it up to simulate or test some use cases.
|
|
22
|
+
|
|
23
|
+
The promise of Gaunt Sloth:
|
|
24
|
+
|
|
25
|
+
- **Minimum dependencies**. Ideally, we aim to only have CommanderJS and some packages from LangChainJS and LangGraphJS.
|
|
26
|
+
- **Extensibility**. Feel free to write some JS and create your Tool, Provider or connect to the MCP server of your choice.
|
|
27
|
+
- **No vendor lock-in**. Just BYO API keys.
|
|
28
|
+
- **Easy installation via NPM**.
|
|
29
|
+
- **All prompts are editable** via markdown files.
|
|
30
|
+
- **No UI**. Command Line only, with intent to be used as a dependency, potentially in your build pipeline.
|
|
31
|
+
Of course, you can use Gaunt Sloth as a dependency and hook your own UI.
|
|
32
|
+
|
|
33
|
+
## What GSloth does:
|
|
34
|
+
|
|
35
|
+
- Reviews code;
|
|
36
|
+
- Suggests bug fixes;
|
|
37
|
+
- Explains provided code
|
|
38
|
+
- Reviews Diffs provided with pipe (|);
|
|
39
|
+
- You can ask GSloth to review your own code before committing (`git --no-pager diff | gsloth review`).
|
|
40
|
+
- Reviews Pull Requests (PRs) (`gsloth pr 42`);
|
|
41
|
+
- Fetches descriptions (requirements) from Github issue or Jira (`gsloth pr 42 12`);;
|
|
42
|
+
- Answers questions about provided code;
|
|
43
|
+
- Writes code;
|
|
44
|
+
- Connects to MCP server;
|
|
45
|
+
- Saves all responses in .md file in the project directory;
|
|
46
|
+
- Anything else you need, when combined with other command line tools.
|
|
47
|
+
|
|
48
|
+
### To make GSloth work, you need an **API key** from some AI provider, such as:
|
|
49
|
+
|
|
50
|
+
- Google Vertex AI;
|
|
51
|
+
- Anthropic;
|
|
52
|
+
- Groq;
|
|
53
|
+
- DeepSeek.
|
|
54
|
+
|
|
55
|
+
`*` Any other provider supported by LangChain.JS should also work with [JS config](./docs/CONFIGURATION.md#JavaScript-Configuration).
|
|
56
|
+
|
|
57
|
+
## Commands Overview
|
|
58
|
+
|
|
59
|
+
`gth` and `gsloth` commands are used interchangeably, both `gsloth pr 42` and `gth pr 42` do the same thing.
|
|
60
|
+
|
|
61
|
+
For detailed information about all commands, see [docs/COMMANDS.md](./docs/COMMANDS.md).
|
|
62
|
+
|
|
63
|
+
### Available Commands:
|
|
64
|
+
|
|
65
|
+
- **`init`** - Initialize Gaunt Sloth in your project with a specific AI provider
|
|
66
|
+
- **`pr`** - ⚠️ This feature requires GitHub CLI to be installed. Review pull requests with optional requirement integration (GitHub issues or Jira).
|
|
67
|
+
- **`review`** - Review any diff or content from various sources
|
|
68
|
+
- **`ask`** - Ask questions about code or programming topics
|
|
69
|
+
- **`chat`** - Start an interactive chat session
|
|
70
|
+
- **`code`** - Write code interactively with full project context
|
|
71
|
+
|
|
72
|
+
### Quick Examples:
|
|
73
|
+
|
|
74
|
+
**Initialize project:**
|
|
75
|
+
```shell
|
|
76
|
+
gsloth init anthropic
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Review PR with requirements:**
|
|
80
|
+
```shell
|
|
81
|
+
gsloth pr 42 23 # Review PR #42 with GitHub issue #23
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Review local changes:**
|
|
85
|
+
```shell
|
|
86
|
+
git --no-pager diff | gsloth review
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Ask questions:**
|
|
90
|
+
```shell
|
|
91
|
+
gsloth ask "What does this function do?" -f utils.js
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Interactive sessions:**
|
|
95
|
+
```shell
|
|
96
|
+
gsloth chat # Start chat session
|
|
97
|
+
gsloth code # Start coding session
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Installation
|
|
101
|
+
|
|
102
|
+
Tested with Node 22 LTS.
|
|
103
|
+
|
|
104
|
+
### NPM
|
|
105
|
+
```shell
|
|
106
|
+
npm install gaunt-sloth-assistant -g
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
> Gaunt Sloth currently only functions from the directory which has a configuration file (`.gsloth.config.js`, `.gsloth.config.json`, or `.gsloth.config.mjs`) and `.gsloth.guidelines.md`.
|
|
112
|
+
> Global configuration to invoke gsloth anywhere is in [ROADMAP](ROADMAP.md).
|
|
113
|
+
|
|
114
|
+
Configuration can be created with `gsloth init [vendor]` command.
|
|
115
|
+
Currently, vertexai, anthropic, groq and deepseek can be configured with `gsloth init [vendor]`.
|
|
116
|
+
|
|
117
|
+
More detailed information on configuration can be found in [CONFIGURATION.md](./docs/CONFIGURATION.md)
|
|
118
|
+
|
|
119
|
+
### Google Vertex AI
|
|
120
|
+
```shell
|
|
121
|
+
cd ./your-project
|
|
122
|
+
gsloth init vertexai
|
|
123
|
+
gcloud auth login
|
|
124
|
+
gcloud auth application-default login
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Anthropic
|
|
128
|
+
|
|
129
|
+
```shell
|
|
130
|
+
cd ./your-project
|
|
131
|
+
gsloth init anthropic
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Make sure you either define `ANTHROPIC_API_KEY` environment variable or edit your configuration file and set up your key.
|
|
135
|
+
|
|
136
|
+
### Groq
|
|
137
|
+
```shell
|
|
138
|
+
cd ./your-project
|
|
139
|
+
gsloth init groq
|
|
140
|
+
```
|
|
141
|
+
Make sure you either define `GROQ_API_KEY` environment variable or edit your configuration file and set up your key.
|
|
142
|
+
|
|
143
|
+
### DeepSeek
|
|
144
|
+
```shell
|
|
145
|
+
cd ./your-project
|
|
146
|
+
gsloth init deepseek
|
|
147
|
+
```
|
|
148
|
+
Make sure you either define `DEEPSEEK_API_KEY` environment variable or edit your configuration file and set up your key.
|
|
149
|
+
It is recommended to obtain API key from DeepSeek official website rather than from a reseller.
|
|
150
|
+
|
|
151
|
+
### Other AI providers
|
|
152
|
+
Any other AI provider supported by Langchain.js can be configured with js [Config](./docs/CONFIGURATION.md).
|
|
153
|
+
|
|
154
|
+
## Contributing
|
|
155
|
+
Contributors are needed! Feel free to create a PR.
|
|
156
|
+
If you are not sure where to start, look for issues with a "good first issue" label.
|
|
157
|
+
|
|
158
|
+
## Building from repo
|
|
159
|
+
See [DEVELOPMENT.md](./docs/DEVELOPMENT.md)
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
License is [MIT](https://opensource.org/license/mit). See [LICENSE](LICENSE)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# v0.7.2 DeepSeek Preset
|
|
2
|
+
|
|
3
|
+
## New Features
|
|
4
|
+
|
|
5
|
+
### DeepSeek Support
|
|
6
|
+
- Added DeepSeek model preset and necessary dependencies
|
|
7
|
+
|
|
8
|
+
## Dependency Updates
|
|
9
|
+
- Updated LangChain, LangGraph and other dependencies
|
|
10
|
+
|
|
11
|
+
## Other Changes
|
|
12
|
+
- Updated documentation to include DeepSeek preset
|
|
13
|
+
|
|
14
|
+
> *Note: This release note was generated by DeepSeek Reasoner. For more details, see the [discussion thread](https://github.com/andruhon/gaunt-sloth-assistant/discussions/80).*
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# v0.7.3 Prebuilt Tools and automatic Jira Worklogs
|
|
2
|
+
|
|
3
|
+
## New Features
|
|
4
|
+
|
|
5
|
+
### Prebuilt Tools
|
|
6
|
+
Introduced a new feature of prebuilt tools, which can be enabled in config:
|
|
7
|
+
|
|
8
|
+
For example, this config below will allow doing something like `gth ask "log time to jira BO-4242 with comment research"`:
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"llm": {
|
|
12
|
+
"type": "vertexai",
|
|
13
|
+
"model": "gemini-2.5-pro"
|
|
14
|
+
},
|
|
15
|
+
"requirementsProviderConfig": {
|
|
16
|
+
"jira": {
|
|
17
|
+
"cloudId": "77777777-7777-7777-77aa-424242424242",
|
|
18
|
+
"displayUrl": "https://yourcompany.atlassian.net/browse/"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"commands": {
|
|
22
|
+
"pr": {
|
|
23
|
+
"contentProvider": "github",
|
|
24
|
+
"requirementsProvider": "jira"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"builtInTools": [
|
|
28
|
+
"gth_jira_log_work"
|
|
29
|
+
]
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Currently `gth_jira_log_work` and `gth_status_update` are the only prebuilt tools available.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Automatically log time to Jira when after doing PR review
|
|
37
|
+
|
|
38
|
+
Similarly, this config below will allow automatically allow time to be logged after completing PR review with `gth pr 4242 BO-4242`:
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"llm": {
|
|
42
|
+
"type": "vertexai",
|
|
43
|
+
"model": "gemini-2.5-pro"
|
|
44
|
+
},
|
|
45
|
+
"requirementsProviderConfig": {
|
|
46
|
+
"jira": {
|
|
47
|
+
"cloudId": "77777777-7777-7777-77aa-424242424242",
|
|
48
|
+
"displayUrl": "https://yourcompany.atlassian.net/browse/"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"commands": {
|
|
52
|
+
"pr": {
|
|
53
|
+
"contentProvider": "github",
|
|
54
|
+
"requirementsProvider": "jira",
|
|
55
|
+
"logWorkForReviewInSeconds": 600
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"builtInTools": [
|
|
59
|
+
"gth_jira_log_work"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`logWorkForReviewInSeconds` is a number of seconds to be logged every time to reviewed Jira.
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StructuredToolInterface } from '@langchain/core/tools';
|
|
2
|
+
import { SlothConfig } from '#src/config.js';
|
|
3
|
+
/**
|
|
4
|
+
* Get default tools based on filesystem and built-in tools configuration
|
|
5
|
+
*/
|
|
6
|
+
export declare function getDefaultTools(config: SlothConfig): Promise<StructuredToolInterface[]>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import GthFileSystemToolkit from '#src/tools/GthFileSystemToolkit.js';
|
|
2
|
+
import { displayWarning } from '#src/consoleUtils.js';
|
|
3
|
+
import { getCurrentDir } from '#src/systemUtils.js';
|
|
4
|
+
const AVAILABLE_BUILT_IN_TOOLS = {
|
|
5
|
+
gth_status_update: '#src/tools/gthStatusUpdateTool.js',
|
|
6
|
+
gth_jira_log_work: '#src/tools/gthJiraLogWorkTool.js',
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Get default tools based on filesystem and built-in tools configuration
|
|
10
|
+
*/
|
|
11
|
+
export async function getDefaultTools(config) {
|
|
12
|
+
const filesystemTools = filterFilesystemTools(new GthFileSystemToolkit([getCurrentDir()]), config.filesystem);
|
|
13
|
+
const builtInTools = await getBuiltInTools(config);
|
|
14
|
+
return [...filesystemTools, ...builtInTools];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Filter filesystem tools based on configuration
|
|
18
|
+
*/
|
|
19
|
+
function filterFilesystemTools(toolkit, filesystemConfig) {
|
|
20
|
+
if (filesystemConfig === 'all') {
|
|
21
|
+
return toolkit.getTools();
|
|
22
|
+
}
|
|
23
|
+
if (filesystemConfig === 'none') {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
if (filesystemConfig === 'read') {
|
|
27
|
+
// Read-only: only allow read operations
|
|
28
|
+
return toolkit.getFilteredTools(['read']);
|
|
29
|
+
}
|
|
30
|
+
if (!Array.isArray(filesystemConfig)) {
|
|
31
|
+
return toolkit.getTools();
|
|
32
|
+
}
|
|
33
|
+
if (filesystemConfig.includes('all')) {
|
|
34
|
+
return toolkit.getTools();
|
|
35
|
+
}
|
|
36
|
+
// Handle an array of specific tool names or 'read'/'all'
|
|
37
|
+
const allowedTools = filesystemConfig.includes('read')
|
|
38
|
+
? toolkit.getFilteredTools(['read'])
|
|
39
|
+
: [];
|
|
40
|
+
// Also allow specific tool names
|
|
41
|
+
const allowedToolNames = new Set(filesystemConfig.filter((name) => name !== 'read' && name !== 'all'));
|
|
42
|
+
const specificNamedTools = toolkit.getTools().filter((tool) => {
|
|
43
|
+
return tool.name && allowedToolNames.has(tool.name);
|
|
44
|
+
});
|
|
45
|
+
// Combine and deduplicate
|
|
46
|
+
const allAllowedTools = [...allowedTools, ...specificNamedTools];
|
|
47
|
+
return allAllowedTools.filter((tool, index, arr) => arr.findIndex((t) => t.name === tool.name) === index);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Get built-in tools based on configuration
|
|
51
|
+
*/
|
|
52
|
+
async function getBuiltInTools(config) {
|
|
53
|
+
const tools = [];
|
|
54
|
+
if (!config.builtInTools) {
|
|
55
|
+
return tools;
|
|
56
|
+
}
|
|
57
|
+
for (const toolName of config.builtInTools) {
|
|
58
|
+
if (toolName in AVAILABLE_BUILT_IN_TOOLS) {
|
|
59
|
+
try {
|
|
60
|
+
const tool = await import(AVAILABLE_BUILT_IN_TOOLS[toolName]);
|
|
61
|
+
tools.push(tool.get(config));
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
displayWarning(`Failed to load built-in tool '${toolName}': ${error}`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
displayWarning(`Unknown built-in tool: ${toolName}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return tools;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=builtInToolsConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtInToolsConfig.js","sourceRoot":"","sources":["../src/builtInToolsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,wBAAwB,GAAG;IAC/B,iBAAiB,EAAE,mCAAmC;IACtD,iBAAiB,EAAE,kCAAkC;CACtD,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,MAAmB;IACvD,MAAM,eAAe,GAAG,qBAAqB,CAC3C,IAAI,oBAAoB,CAAC,CAAC,aAAa,EAAE,CAAC,CAAC,EAC3C,MAAM,CAAC,UAAU,CAClB,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,CAAC;IAEnD,OAAO,CAAC,GAAG,eAAe,EAAE,GAAG,YAAY,CAAC,CAAC;AAC/C,CAAC;AAED;;GAEG;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YAAY,EAAE,GAAG,kBAAkB,CAAC,CAAC;IACjE,OAAO,eAAe,CAAC,MAAM,CAC3B,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAC3E,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,eAAe,CAAC,MAAmB;IAChD,MAAM,KAAK,GAA8B,EAAE,CAAC;IAE5C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QAC3C,IAAI,QAAQ,IAAI,wBAAwB,EAAE,CAAC;YACzC,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,MAAM,CACvB,wBAAwB,CAAC,QAAiD,CAAC,CAC5E,CAAC;gBACF,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,cAAc,CAAC,iCAAiC,QAAQ,MAAM,KAAK,EAAE,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,cAAc,CAAC,0BAA0B,QAAQ,EAAE,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Option } from 'commander';
|
|
2
2
|
import { readBackstory, readGuidelines, readReviewInstructions, readSystemPrompt, } from '#src/prompt.js';
|
|
3
3
|
import { readMultipleFilesFromCurrentDir } from '#src/utils.js';
|
|
4
|
-
import {
|
|
4
|
+
import { CONTENT_PROVIDERS, getRequirementsFromProvider, REQUIREMENTS_PROVIDERS, } from './commandUtils.js';
|
|
5
|
+
import jiraLogWork from '#src/helpers/jira/jiraLogWork.js';
|
|
5
6
|
export function prCommand(program) {
|
|
6
7
|
program
|
|
7
8
|
.command('pr')
|
|
@@ -12,6 +13,7 @@ export function prCommand(program) {
|
|
|
12
13
|
.argument('[requirementsId]', 'Optional requirements ID argument to retrieve requirements with requirements provider')
|
|
13
14
|
.addOption(new Option('-p, --requirements-provider <requirementsProvider>', 'Requirements provider for this review.').choices(Object.keys(REQUIREMENTS_PROVIDERS)))
|
|
14
15
|
.option('-f, --file [files...]', 'Input files. Content of these files will be added BEFORE the diff, but after requirements')
|
|
16
|
+
.option('-m, --message <message>', 'Extra message to provide just before the content')
|
|
15
17
|
.action(async (prId, requirementsId, options) => {
|
|
16
18
|
const { initConfig } = await import('#src/config.js');
|
|
17
19
|
const config = await initConfig(); // Initialize and get config
|
|
@@ -43,10 +45,21 @@ export function prCommand(program) {
|
|
|
43
45
|
const providerPath = `#src/providers/${CONTENT_PROVIDERS[contentProvider]}`;
|
|
44
46
|
const { get } = await import(providerPath);
|
|
45
47
|
content.push(await get(null, prId));
|
|
48
|
+
if (options.message) {
|
|
49
|
+
content.push(options.message);
|
|
50
|
+
}
|
|
46
51
|
const { review } = await import('#src/modules/reviewModule.js');
|
|
47
52
|
// TODO consider including requirements id
|
|
48
53
|
// TODO sanitize prId
|
|
49
54
|
await review(`PR-${prId}`, systemMessage.join('\n'), content.join('\n'), config, 'pr');
|
|
55
|
+
if (requirementsId &&
|
|
56
|
+
(config.commands?.pr?.requirementsProvider ?? config.requirementsProvider) === 'jira' &&
|
|
57
|
+
config.commands?.pr?.logWorkForReviewInSeconds) {
|
|
58
|
+
// TODO we need to figure out some sort of post-processors
|
|
59
|
+
let jiraConfig = config.prebuiltToolsConfig?.jira ||
|
|
60
|
+
config.requirementsProviderConfig?.jira;
|
|
61
|
+
await jiraLogWork(jiraConfig, requirementsId, config.commands?.pr?.logWorkForReviewInSeconds, 'code review');
|
|
62
|
+
}
|
|
50
63
|
});
|
|
51
64
|
}
|
|
52
65
|
//# sourceMappingURL=prCommand.js.map
|
|
@@ -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,EACL,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,+BAA+B,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EACL,
|
|
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,iBAAiB,EAEjB,2BAA2B,EAC3B,sBAAsB,GAEvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,WAAW,MAAM,kCAAkC,CAAC;AAS3D,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,CACP,kBAAkB,EAClB,uFAAuF,CACxF;SACA,SAAS,CACR,IAAI,MAAM,CACR,oDAAoD,EACpD,wCAAwC,CACzC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAC/C;SACA,MAAM,CACL,uBAAuB,EACvB,2FAA2F,CAC5F;SACA,MAAM,CAAC,yBAAyB,EAAE,kDAAkD,CAAC;SACrF,MAAM,CAAC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