gaunt-sloth-assistant 0.1.3 → 0.1.4

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.
Files changed (43) hide show
  1. package/.eslint.config.mjs +0 -0
  2. package/.github/dependabot.yml +0 -0
  3. package/.github/workflows/ci.yml +0 -0
  4. package/.gsloth.preamble.internal.md +0 -0
  5. package/.gsloth.preamble.review.md +0 -0
  6. package/LICENSE +0 -0
  7. package/README.md +0 -0
  8. package/ROADMAP.md +0 -0
  9. package/UX-RESEARCH.md +0 -0
  10. package/docs/CONFIGURATION.md +0 -0
  11. package/docs/DEVELOPMENT.md +0 -0
  12. package/docs/RELEASE-HOWTO.md +0 -0
  13. package/eslint.config.js +0 -0
  14. package/package.json +1 -1
  15. package/spec/.gsloth.config.js +0 -0
  16. package/spec/.gsloth.config.json +0 -0
  17. package/spec/askCommand.spec.js +0 -0
  18. package/spec/config.spec.js +0 -0
  19. package/spec/initCommand.spec.js +0 -0
  20. package/spec/predefinedConfigs.spec.js +0 -0
  21. package/spec/questionAnsweringModule.spec.js +0 -0
  22. package/spec/reviewCommand.spec.js +40 -0
  23. package/spec/reviewModule.spec.js +0 -0
  24. package/spec/support/jasmine.mjs +0 -0
  25. package/src/commands/askCommand.js +0 -0
  26. package/src/commands/initCommand.js +0 -0
  27. package/src/commands/reviewCommand.js +0 -0
  28. package/src/config.js +0 -0
  29. package/src/configs/anthropic.js +0 -0
  30. package/src/configs/fake.js +0 -0
  31. package/src/configs/groq.js +0 -0
  32. package/src/configs/vertexai.js +0 -0
  33. package/src/consoleUtils.js +0 -0
  34. package/src/modules/questionAnsweringModule.js +0 -0
  35. package/src/modules/reviewModule.js +0 -0
  36. package/src/prompt.js +0 -0
  37. package/src/providers/file.js +0 -0
  38. package/src/providers/ghPrDiffProvider.js +0 -0
  39. package/src/providers/jiraIssueLegacyAccessTokenProvider.js +12 -3
  40. package/src/providers/text.js +0 -0
  41. package/src/systemUtils.js +0 -0
  42. package/src/utils.js +0 -0
  43. package/testMessage.txt +0 -0
File without changes
File without changes
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
File without changes
File without changes
File without changes
package/eslint.config.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaunt-sloth-assistant",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": "Andrew Kondratev",
File without changes
File without changes
File without changes
File without changes
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
File without changes
File without changes
File without changes
File without changes
package/src/config.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/src/prompt.js CHANGED
File without changes
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, token, baseUrl} = config;
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 || !token || !baseUrl) {
29
- throw new Error('Missing required parameters in config (username, token, baseUrl) or missing jiraKey.');
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
File without changes
File without changes
package/src/utils.js CHANGED
File without changes
package/testMessage.txt CHANGED
File without changes