gaunt-sloth-assistant 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslint.config.mjs +0 -0
- package/.github/dependabot.yml +0 -0
- package/.github/workflows/ci.yml +0 -0
- package/.gsloth.preamble.internal.md +0 -0
- package/.gsloth.preamble.review.md +0 -0
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/ROADMAP.md +0 -0
- package/UX-RESEARCH.md +0 -0
- package/docs/CONFIGURATION.md +0 -0
- package/docs/DEVELOPMENT.md +0 -0
- package/docs/RELEASE-HOWTO.md +0 -0
- package/eslint.config.js +0 -0
- package/package.json +1 -1
- package/spec/.gsloth.config.js +0 -0
- package/spec/.gsloth.config.json +0 -0
- package/spec/askCommand.spec.js +0 -0
- package/spec/config.spec.js +0 -0
- package/spec/initCommand.spec.js +0 -0
- package/spec/predefinedConfigs.spec.js +0 -0
- package/spec/questionAnsweringModule.spec.js +0 -0
- package/spec/reviewCommand.spec.js +40 -0
- package/spec/reviewModule.spec.js +0 -0
- package/spec/support/jasmine.mjs +0 -0
- package/src/commands/askCommand.js +0 -0
- package/src/commands/initCommand.js +0 -0
- package/src/commands/reviewCommand.js +0 -0
- package/src/config.js +0 -0
- package/src/configs/anthropic.js +0 -0
- package/src/configs/fake.js +0 -0
- package/src/configs/groq.js +0 -0
- package/src/configs/vertexai.js +0 -0
- package/src/consoleUtils.js +0 -0
- package/src/modules/questionAnsweringModule.js +0 -0
- package/src/modules/reviewModule.js +0 -0
- package/src/prompt.js +0 -0
- package/src/providers/file.js +0 -0
- package/src/providers/ghPrDiffProvider.js +0 -0
- package/src/providers/jiraIssueLegacyAccessTokenProvider.js +12 -3
- package/src/providers/text.js +0 -0
- package/src/systemUtils.js +0 -0
- package/src/utils.js +0 -0
- package/testMessage.txt +0 -0
package/.eslint.config.mjs
CHANGED
File without changes
|
package/.github/dependabot.yml
CHANGED
File without changes
|
package/.github/workflows/ci.yml
CHANGED
File without changes
|
File without changes
|
File without changes
|
package/LICENSE
CHANGED
File without changes
|
package/README.md
CHANGED
File without changes
|
package/ROADMAP.md
CHANGED
File without changes
|
package/UX-RESEARCH.md
CHANGED
File without changes
|
package/docs/CONFIGURATION.md
CHANGED
File without changes
|
package/docs/DEVELOPMENT.md
CHANGED
File without changes
|
package/docs/RELEASE-HOWTO.md
CHANGED
File without changes
|
package/eslint.config.js
CHANGED
File without changes
|
package/package.json
CHANGED
package/spec/.gsloth.config.js
CHANGED
File without changes
|
package/spec/.gsloth.config.json
CHANGED
File without changes
|
package/spec/askCommand.spec.js
CHANGED
File without changes
|
package/spec/config.spec.js
CHANGED
File without changes
|
package/spec/initCommand.spec.js
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -125,6 +125,46 @@ describe('reviewCommand', function (){
|
|
125
125
|
td.verify(this.review('sloth-DIFF-review', "INTERNAL PREAMBLE\nPROJECT PREAMBLE", "JIRA Requirements"));
|
126
126
|
});
|
127
127
|
|
128
|
+
it('Should display meaningful error, when JIRA is enabled, but JIRA token is absent', async function() {
|
129
|
+
const testOutput = { text: '' };
|
130
|
+
|
131
|
+
const { reviewCommand } = await import("../src/commands/reviewCommand.js");
|
132
|
+
const program = new Command();
|
133
|
+
program.configureOutput({
|
134
|
+
writeOut: (str) => testOutput.text += str,
|
135
|
+
writeErr: (str) => testOutput.text += str
|
136
|
+
});
|
137
|
+
|
138
|
+
const context = {
|
139
|
+
config: {
|
140
|
+
requirementsProvider: 'jira-legacy',
|
141
|
+
requirementsProviderConfig: {
|
142
|
+
'jira-legacy': {
|
143
|
+
username: 'test-user',
|
144
|
+
baseUrl: 'https://test-jira.atlassian.net/rest/api/2/issue/'
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
};
|
149
|
+
|
150
|
+
// Mock the jira provider
|
151
|
+
const jiraProvider = td.func();
|
152
|
+
td.when(jiraProvider(td.matchers.anything(), 'JIRA-123')).thenResolve('JIRA Requirements');
|
153
|
+
|
154
|
+
|
155
|
+
await reviewCommand(program, context);
|
156
|
+
try {
|
157
|
+
await program.parseAsync(['na', 'na', 'pr', 'content-id', 'JIRA-123']);
|
158
|
+
} catch (e) {
|
159
|
+
expect(e.message)
|
160
|
+
.toContain(
|
161
|
+
'Missing JIRA Legacy API token. ' +
|
162
|
+
'The legacy token can be defined as JIRA_LEGACY_API_TOKEN environment variable ' +
|
163
|
+
'or as "token" in config.'
|
164
|
+
);
|
165
|
+
}
|
166
|
+
});
|
167
|
+
|
128
168
|
it('Should call review with predefined content provider', async function() {
|
129
169
|
const { reviewCommand } = await import("../src/commands/reviewCommand.js");
|
130
170
|
const program = new Command();
|
File without changes
|
package/spec/support/jasmine.mjs
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
package/src/config.js
CHANGED
File without changes
|
package/src/configs/anthropic.js
CHANGED
File without changes
|
package/src/configs/fake.js
CHANGED
File without changes
|
package/src/configs/groq.js
CHANGED
File without changes
|
package/src/configs/vertexai.js
CHANGED
File without changes
|
package/src/consoleUtils.js
CHANGED
File without changes
|
File without changes
|
File without changes
|
package/src/prompt.js
CHANGED
File without changes
|
package/src/providers/file.js
CHANGED
File without changes
|
File without changes
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import {display, displayWarning} from "../consoleUtils.js";
|
2
|
+
import { env } from "../systemUtils.js";
|
2
3
|
|
3
4
|
export async function get(config, prId) {
|
4
5
|
const issueData = await getJiraIssue(config, prId);
|
@@ -18,15 +19,23 @@ export async function get(config, prId) {
|
|
18
19
|
* @throws {Error} Throws an error if the fetch fails, authentication is wrong, the issue is not found, or the response status is not OK.
|
19
20
|
*/
|
20
21
|
async function getJiraIssue(config, jiraKey) {
|
21
|
-
const {username,
|
22
|
+
const {username, baseUrl} = config;
|
22
23
|
if (!jiraKey) {
|
23
24
|
displayWarning("No jiraKey provided, skipping Jira issue fetching.");
|
24
25
|
return "";
|
25
26
|
}
|
27
|
+
const token = env.JIRA_LEGACY_API_TOKEN ?? config?.token;
|
28
|
+
|
29
|
+
if (!token) {
|
30
|
+
throw new Error(
|
31
|
+
'Missing JIRA Legacy API token. ' +
|
32
|
+
'The legacy token can be defined as JIRA_LEGACY_API_TOKEN environment variable or as "token" in config.'
|
33
|
+
);
|
34
|
+
}
|
26
35
|
|
27
36
|
// Validate essential inputs
|
28
|
-
if (!username || !
|
29
|
-
throw new Error('Missing required parameters in config
|
37
|
+
if (!username || !baseUrl) {
|
38
|
+
throw new Error('Missing required parameters in config: username or baseUrl');
|
30
39
|
}
|
31
40
|
|
32
41
|
// Ensure baseUrl doesn't end with a slash to avoid double slashes in the URL
|
package/src/providers/text.js
CHANGED
File without changes
|
package/src/systemUtils.js
CHANGED
File without changes
|
package/src/utils.js
CHANGED
File without changes
|
package/testMessage.txt
CHANGED
File without changes
|