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
@@ -1,4 +1,3 @@
|
|
1
|
-
import { slothContext } from '#src/config.js';
|
2
1
|
import { display, displayError, displaySuccess } from '#src/consoleUtils.js';
|
3
2
|
import { getGslothFilePath } from '#src/filePathUtils.js';
|
4
3
|
import { generateStandardFileName, ProgressIndicator } from '#src/utils.js';
|
@@ -10,15 +9,15 @@ import { invoke } from '#src/llmUtils.js';
|
|
10
9
|
* @param preamble - The preamble to send to the LLM
|
11
10
|
* @param content - The content of the question
|
12
11
|
*/
|
13
|
-
export async function askQuestion(source, preamble, content) {
|
14
|
-
const progressIndicator = new ProgressIndicator('Thinking.');
|
15
|
-
const outputContent = await invoke(
|
16
|
-
progressIndicator
|
12
|
+
export async function askQuestion(source, preamble, content, config) {
|
13
|
+
const progressIndicator = config.streamOutput ? undefined : new ProgressIndicator('Thinking.');
|
14
|
+
const outputContent = await invoke(config.llm, preamble, content, config, 'ask');
|
15
|
+
progressIndicator?.stop();
|
17
16
|
const filename = generateStandardFileName(source);
|
18
17
|
const filePath = getGslothFilePath(filename);
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
if (!config.streamOutput) {
|
19
|
+
display('\n' + outputContent);
|
20
|
+
}
|
22
21
|
try {
|
23
22
|
writeFileSync(filePath, outputContent);
|
24
23
|
displaySuccess(`This report can be found in ${filePath}`);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"questionAnsweringModule.js","sourceRoot":"","sources":["../../src/modules/questionAnsweringModule.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"questionAnsweringModule.js","sourceRoot":"","sources":["../../src/modules/questionAnsweringModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAc,EACd,QAAgB,EAChB,OAAe,EACf,MAAmB;IAEnB,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC/F,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACjF,iBAAiB,EAAE,IAAI,EAAE,CAAC;IAC1B,MAAM,QAAQ,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,GAAG,aAAa,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,CAAC;QACH,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACvC,cAAc,CAAC,+BAA+B,QAAQ,EAAE,CAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,YAAY,CAAC,mCAAmC,QAAQ,EAAE,CAAC,CAAC;QAC5D,YAAY,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACrE,yDAAyD;QACzD,WAAW;IACb,CAAC;AACH,CAAC"}
|
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
import type { SlothConfig } from '#src/config.js';
|
2
|
+
export declare function review(source: string, preamble: string, diff: string, config: SlothConfig, command?: 'pr' | 'review'): Promise<void>;
|
@@ -1,21 +1,17 @@
|
|
1
|
-
import { slothContext } from '#src/config.js';
|
2
1
|
import { display, displayDebug, displayError, displaySuccess } from '#src/consoleUtils.js';
|
3
|
-
import { stdout } from '#src/systemUtils.js';
|
4
2
|
import { generateStandardFileName, ProgressIndicator } from '#src/utils.js';
|
5
3
|
import { writeFileSync } from 'node:fs';
|
6
4
|
import { invoke } from '#src/llmUtils.js';
|
7
5
|
import { getGslothFilePath } from '#src/filePathUtils.js';
|
8
|
-
export async function review(source, preamble, diff) {
|
9
|
-
const progressIndicator = new ProgressIndicator('Reviewing.');
|
10
|
-
const outputContent = await invoke(
|
11
|
-
progressIndicator
|
6
|
+
export async function review(source, preamble, diff, config, command = 'review') {
|
7
|
+
const progressIndicator = config.streamOutput ? undefined : new ProgressIndicator('Reviewing.');
|
8
|
+
const outputContent = await invoke(config.llm, preamble, diff, config, command);
|
9
|
+
progressIndicator?.stop();
|
12
10
|
const filename = generateStandardFileName(source);
|
13
11
|
const filePath = getGslothFilePath(filename);
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
// TODO highlight LLM output with something like Prism.JS (maybe system emoj are enough ✅⚠️❌)
|
18
|
-
display(outputContent);
|
12
|
+
if (!config.streamOutput) {
|
13
|
+
display('\n' + outputContent);
|
14
|
+
}
|
19
15
|
try {
|
20
16
|
writeFileSync(filePath, outputContent);
|
21
17
|
displaySuccess(`This report can be found in ${filePath}`);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"reviewModule.js","sourceRoot":"","sources":["../../src/modules/reviewModule.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"reviewModule.js","sourceRoot":"","sources":["../../src/modules/reviewModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,MAAc,EACd,QAAgB,EAChB,IAAY,EACZ,MAAmB,EACnB,UAA2B,QAAQ;IAEnC,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,iBAAiB,CAAC,YAAY,CAAC,CAAC;IAChG,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IAChF,iBAAiB,EAAE,IAAI,EAAE,CAAC;IAC1B,MAAM,QAAQ,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,QAAQ,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC7C,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,GAAG,aAAa,CAAC,CAAC;IAChC,CAAC;IACD,IAAI,CAAC;QACH,aAAa,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;QACvC,cAAc,CAAC,+BAA+B,QAAQ,EAAE,CAAC,CAAC;IAC5D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,YAAY,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7D,YAAY,CAAC,mCAAmC,QAAQ,EAAE,CAAC,CAAC;QAC5D,qDAAqD;QACrD,WAAW;IACb,CAAC;AACH,CAAC"}
|
package/dist/modules/types.d.ts
CHANGED
File without changes
|
package/dist/modules/types.js
CHANGED
File without changes
|
File without changes
|
package/dist/prompt.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare function readBackstory(): string;
|
2
2
|
export declare function readGuidelines(guidelinesFilename: string): string;
|
3
3
|
export declare function readReviewInstructions(reviewInstructions: string): string;
|
4
|
+
export declare function readSystemPrompt(): string;
|
4
5
|
/**
|
5
6
|
* This function expects https://cli.github.com/ to be installed and authenticated.
|
6
7
|
* It does something like `gh pr diff 42`
|
package/dist/prompt.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { readFileFromCurrentDir, readFileFromCurrentOrInstallDir, spawnCommand, } from '#src/utils.js';
|
2
2
|
import { displayError } from '#src/consoleUtils.js';
|
3
3
|
import { exit } from '#src/systemUtils.js';
|
4
|
-
import { GSLOTH_BACKSTORY } from '#src/
|
4
|
+
import { GSLOTH_BACKSTORY, GSLOTH_SYSTEM_PROMPT } from '#src/constants.js';
|
5
5
|
import { getGslothConfigReadPath } from '#src/filePathUtils.js';
|
6
6
|
export function readBackstory() {
|
7
7
|
return readFileFromCurrentOrInstallDir(GSLOTH_BACKSTORY, true);
|
@@ -19,6 +19,9 @@ export function readGuidelines(guidelinesFilename) {
|
|
19
19
|
export function readReviewInstructions(reviewInstructions) {
|
20
20
|
return readConfigPromptFile(reviewInstructions);
|
21
21
|
}
|
22
|
+
export function readSystemPrompt() {
|
23
|
+
return readFileFromCurrentOrInstallDir(GSLOTH_SYSTEM_PROMPT, true);
|
24
|
+
}
|
22
25
|
function readConfigPromptFile(guidelinesFilename) {
|
23
26
|
try {
|
24
27
|
const filePath = getGslothConfigReadPath(guidelinesFilename);
|
package/dist/prompt.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAC/B,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAC/B,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,MAAM,UAAU,aAAa;IAC3B,OAAO,+BAA+B,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,kBAA0B;IACvD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;QAC7D,OAAO,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,YAAY,CACV,mGAAmG,CACpG,CAAC;QACF,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,kBAA0B;IAC/D,OAAO,oBAAoB,CAAC,kBAAkB,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC9B,OAAO,+BAA+B,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAC;AACrE,CAAC;AAED,SAAS,oBAAoB,CAAC,kBAA0B;IACtD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,uBAAuB,CAAC,kBAAkB,CAAC,CAAC;QAC7D,OAAO,+BAA+B,CAAC,QAAQ,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,YAAY,CACV,mGAAmG,CACpG,CAAC;QACF,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,EAAU;IACxC,iEAAiE;IACjE,IAAI,CAAC;QACH,OAAO,MAAM,YAAY,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,oBAAoB,EAAE,iBAAiB,CAAC,CAAC;IAC/F,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,YAAY,CAAC,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5D,YAAY,CAAC,8BAA8B,EAAE,mCAAmC,CAAC,CAAC;QAClF,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,CAAC,CAAC,gDAAgD;IAC7D,CAAC;AACH,CAAC"}
|
package/dist/providers/file.d.ts
CHANGED
File without changes
|
package/dist/providers/file.js
CHANGED
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { displayWarning } from '#src/consoleUtils.js';
|
2
|
-
import { execAsync } from '#src/utils.js';
|
2
|
+
import { execAsync, ProgressIndicator } from '#src/utils.js';
|
3
3
|
/**
|
4
4
|
* Gets GitHub issue using GitHub CLI
|
5
5
|
* @param _ config (unused in this provider)
|
@@ -13,7 +13,9 @@ export async function get(_, issueId) {
|
|
13
13
|
}
|
14
14
|
try {
|
15
15
|
// Use the GitHub CLI to fetch issue details
|
16
|
+
const progress = new ProgressIndicator(`Fetching GitHub issue #${issueId}`);
|
16
17
|
const issueContent = await execAsync(`gh issue view ${issueId}`);
|
18
|
+
progress.stop();
|
17
19
|
if (!issueContent) {
|
18
20
|
displayWarning(`No content found for GitHub issue #${issueId}`);
|
19
21
|
return null;
|
@@ -1 +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;
|
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,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG7D;;;;;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,QAAQ,GAAG,IAAI,iBAAiB,CAAC,0BAA0B,OAAO,EAAE,CAAC,CAAC;QAC5E,MAAM,YAAY,GAAG,MAAM,SAAS,CAAC,iBAAiB,OAAO,EAAE,CAAC,CAAC;QACjE,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEhB,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"}
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { displayWarning } from '#src/consoleUtils.js';
|
2
|
-
import { execAsync } from '#src/utils.js';
|
2
|
+
import { execAsync, ProgressIndicator } from '#src/utils.js';
|
3
3
|
/**
|
4
4
|
* Gets PR diff using GitHub CLI
|
5
5
|
* @param _ config (unused in this provider)
|
@@ -13,7 +13,9 @@ export async function get(_, prId) {
|
|
13
13
|
}
|
14
14
|
try {
|
15
15
|
// Use the GitHub CLI to fetch PR diff
|
16
|
+
const progress = new ProgressIndicator(`Fetching GitHub PR #${prId} diff`);
|
16
17
|
const prDiffContent = await execAsync(`gh pr diff ${prId}`);
|
18
|
+
progress.stop();
|
17
19
|
if (!prDiffContent) {
|
18
20
|
displayWarning(`No diff content found for GitHub PR #${prId}`);
|
19
21
|
return null;
|
@@ -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;
|
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,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAG7D;;;;;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,QAAQ,GAAG,IAAI,iBAAiB,CAAC,uBAAuB,IAAI,OAAO,CAAC,CAAC;QAC3E,MAAM,aAAa,GAAG,MAAM,SAAS,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;QAC5D,QAAQ,CAAC,IAAI,EAAE,CAAC;QAEhB,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"}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { display, displayError, displayWarning } from '#src/consoleUtils.js';
|
2
2
|
import { env } from '#src/systemUtils.js';
|
3
|
+
import { ProgressIndicator } from '#src/utils.js';
|
3
4
|
/**
|
4
5
|
* Gets Jira issue using Atlassian REST API v3 with Personal Access Token
|
5
6
|
*
|
@@ -72,7 +73,6 @@ async function getJiraIssue(config, jiraKey) {
|
|
72
73
|
if (config.displayUrl) {
|
73
74
|
display(`Loading Jira issue ${config.displayUrl}${jiraKey}`);
|
74
75
|
}
|
75
|
-
display(`Retrieving jira from api ${apiUrl.replace(/^https?:\/\//, '')}`);
|
76
76
|
// This filter will be necessary for V3: `&expand=renderedFields` to convert ADF to HTML
|
77
77
|
const filters = '?fields=summary,description'; // Limit JSON to summary and description
|
78
78
|
// Encode credentials for Basic Authentication header
|
@@ -85,10 +85,12 @@ async function getJiraIssue(config, jiraKey) {
|
|
85
85
|
Accept: 'application/json; charset=utf-8',
|
86
86
|
'Accept-Language': 'en-US,en;q=0.9', // Prevents errors in other languages
|
87
87
|
};
|
88
|
+
const progressIndicator = new ProgressIndicator(`Retrieving jira from api ${apiUrl.replace(/^https?:\/\//, '')}`);
|
88
89
|
const response = await fetch(apiUrl + filters, {
|
89
90
|
method: 'GET',
|
90
91
|
headers: headers,
|
91
92
|
});
|
93
|
+
progressIndicator.stop();
|
92
94
|
if (!response?.ok) {
|
93
95
|
try {
|
94
96
|
const errorData = await response.json();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"jiraIssueProvider.js","sourceRoot":"","sources":["../../src/providers/jiraIssueProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;
|
1
|
+
{"version":3,"file":"jiraIssueProvider.js","sourceRoot":"","sources":["../../src/providers/jiraIssueProvider.ts"],"names":[],"mappings":"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"}
|
package/dist/providers/text.d.ts
CHANGED
File without changes
|
package/dist/providers/text.js
CHANGED
File without changes
|
File without changes
|
File without changes
|
package/dist/providers/types.js
CHANGED
File without changes
|
File without changes
|
package/dist/systemUtils.d.ts
CHANGED
File without changes
|
package/dist/systemUtils.js
CHANGED
File without changes
|
package/dist/systemUtils.js.map
CHANGED
File without changes
|
package/dist/utils.d.ts
CHANGED
File without changes
|
package/dist/utils.js
CHANGED
File without changes
|
package/dist/utils.js.map
CHANGED
File without changes
|
package/docs/CONFIGURATION.md
CHANGED
@@ -39,35 +39,37 @@ If the `.gsloth` directory doesn't exist, gsloth will continue writing all files
|
|
39
39
|
|
40
40
|
It is always worth checking sourcecode in [config.ts](../src/config.ts) for more insightful information.
|
41
41
|
|
42
|
-
| Parameter | Required | Default Value | Description
|
43
|
-
|
42
|
+
| Parameter | Required | Default Value | Description |
|
43
|
+
|------------------------------------------|-----------------------------------|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
44
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`.
|
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
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
|
-
| `
|
53
|
-
| `commands
|
54
|
-
| `commands.pr
|
55
|
-
| `commands.pr.
|
56
|
-
| `commands.
|
57
|
-
| `commands.review
|
58
|
-
| `commands.review.
|
59
|
-
| `
|
60
|
-
| `requirementsProviderConfig
|
61
|
-
| `requirementsProviderConfig.jira
|
62
|
-
| `requirementsProviderConfig.jira.
|
63
|
-
| `requirementsProviderConfig.jira.
|
64
|
-
| `requirementsProviderConfig.jira.
|
65
|
-
| `requirementsProviderConfig.jira
|
66
|
-
| `requirementsProviderConfig.jira-legacy
|
67
|
-
| `requirementsProviderConfig.jira-legacy.
|
51
|
+
| `projectReviewInstructions` | Optional | `.gsloth.review.md` | Path to the file containing project review instructions. |
|
52
|
+
| `streamOutput` | Optional | `true` | When set to `true`, AI responses are streamed to the console in real-time. When `false`, responses are displayed only after completion. |
|
53
|
+
| `commands` | Optional | - | Configuration for specific commands. |
|
54
|
+
| `commands.pr` | Optional | - | Configuration for the PR command. |
|
55
|
+
| `commands.pr.contentProvider` | Optional | `github` | Content provider used for PR review (`gsloth pr`). |
|
56
|
+
| `commands.pr.requirementsProvider` | Optional | `github` | Requirements provider used for PR review. If not specified, falls back to the global `requirementsProvider`. |
|
57
|
+
| `commands.review` | Optional | - | Configuration for the review command. |
|
58
|
+
| `commands.review.contentProvider` | Optional | - | Content provider specifically for the review command. If not specified, falls back to the global `contentProvider`. |
|
59
|
+
| `commands.review.requirementsProvider` | Optional | - | Requirements provider specifically for the review command. If not specified, falls back to the global `requirementsProvider`. |
|
60
|
+
| `requirementsProviderConfig` | Optional | - | Configuration for requirements providers. Contains provider-specific configurations. |
|
61
|
+
| `requirementsProviderConfig.jira` | Optional | - | Configuration for the Jira requirements provider (Atlassian REST API v3 with Personal Access Token). |
|
62
|
+
| `requirementsProviderConfig.jira.username` | Optional | - | Jira username (email). Can also be set via JIRA_USERNAME environment variable. |
|
63
|
+
| `requirementsProviderConfig.jira.token` | Optional | - | Jira Personal Access Token. Can also be set via JIRA_API_PAT_TOKEN environment variable. |
|
64
|
+
| `requirementsProviderConfig.jira.cloudId` | Required for `jira` | - | Atlassian Cloud ID. Can also be set via JIRA_CLOUD_ID environment variable. |
|
65
|
+
| `requirementsProviderConfig.jira.displayUrl` | Optional | - | Optional URL for displaying Jira issues (e.g., "https://yourcompany.atlassian.net/browse/"). |
|
66
|
+
| `requirementsProviderConfig.jira-legacy` | Optional | - | Configuration for the Jira Legacy requirements provider (Atlassian REST API v2 with Legacy API Token). |
|
67
|
+
| `requirementsProviderConfig.jira-legacy.username` | Optional | - | Jira username (email). Can also be set via JIRA_USERNAME environment variable. |
|
68
|
+
| `requirementsProviderConfig.jira-legacy.token` | Optional | - | Jira Legacy API Token. Can also be set via JIRA_LEGACY_API_TOKEN environment variable. |
|
68
69
|
| `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.
|
70
|
+
| `requirementsProviderConfig.jira-legacy.displayUrl` | Optional | - | Optional URL for displaying Jira issues (e.g., "https://yourcompany.atlassian.net/browse/"). |
|
71
|
+
| `contentProviderConfig` | Optional | - | Configuration for content providers. Currently, the available content providers (`github`, `file`, and `text`) don't require specific configuration. |
|
72
|
+
| `mcpServers` | Optional | - | Configuration for Model Context Protocol (MCP) servers. This allows for enhanced context management. |
|
71
73
|
|
72
74
|
## Config initialization
|
73
75
|
Configuration can be created with `gsloth init [vendor]` command.
|
@@ -195,6 +197,38 @@ export async function configure(importFunction, global) {
|
|
195
197
|
The configure function should simply return instance of langchain [chat model](https://v03.api.js.langchain.com/classes/_langchain_core.language_models_chat_models.BaseChatModel.html).
|
196
198
|
See [Langchain documentation](https://js.langchain.com/docs/tutorials/llm_chain/) for more details.
|
197
199
|
|
200
|
+
## Model Context Protocol (MCP)
|
201
|
+
|
202
|
+
Gaunt Sloth Assistant supports the Model Context Protocol (MCP), which provides enhanced context management.
|
203
|
+
The `@modelcontextprotocol/server-filesystem` package is included as a dependency, allowing you to easily configure file system access for your LLM.
|
204
|
+
|
205
|
+
### MCP Filesystem Server Configuration
|
206
|
+
|
207
|
+
To configure the MCP filesystem server, add the `mcpServers` section to your configuration file:
|
208
|
+
|
209
|
+
```json
|
210
|
+
{
|
211
|
+
"llm": {
|
212
|
+
"type": "vertexai",
|
213
|
+
"model": "gemini-2.5-pro-preview-05-06",
|
214
|
+
"temperature": 0
|
215
|
+
},
|
216
|
+
"mcpServers": {
|
217
|
+
"filesystem": {
|
218
|
+
"transport": "stdio",
|
219
|
+
"command": "npx",
|
220
|
+
"args": [
|
221
|
+
"-y",
|
222
|
+
"@modelcontextprotocol/server-filesystem",
|
223
|
+
"/home/path/to/your/files"
|
224
|
+
]
|
225
|
+
}
|
226
|
+
}
|
227
|
+
}
|
228
|
+
```
|
229
|
+
|
230
|
+
This configuration launches the MCP filesystem server using npx, providing the LLM with access to the specified directory. The server uses stdio for communication with the LLM.
|
231
|
+
|
198
232
|
## Content providers
|
199
233
|
|
200
234
|
### GitHub Issues
|
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
|
File without changes
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "gaunt-sloth-assistant",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.5.1",
|
4
4
|
"description": "",
|
5
5
|
"license": "MIT",
|
6
6
|
"author": "Andrew Kondratev",
|
@@ -14,7 +14,9 @@
|
|
14
14
|
"scripts": {
|
15
15
|
"build": "tsc",
|
16
16
|
"test": "npm run build && vitest run",
|
17
|
-
"it": "npm run build && vitest run --config vitest-it.config.ts",
|
17
|
+
"it-groq": "node integration-tests/setup-config.js groq && npm run build && vitest run --config vitest-it.config.ts",
|
18
|
+
"it-anthropic": "node integration-tests/setup-config.js anthropic && npm run build && vitest run --config vitest-it.config.ts",
|
19
|
+
"it-vertexai": "node integration-tests/setup-config.js vertexai && npm run build && vitest run --config vitest-it.config.ts",
|
18
20
|
"lint": "eslint . --ext .js,.ts",
|
19
21
|
"format": "prettier --write 'src/**/*.{js,ts}'",
|
20
22
|
"prepare": "npm run build"
|
@@ -28,24 +30,26 @@
|
|
28
30
|
"@langchain/core": "^0.3.55",
|
29
31
|
"@langchain/google-vertexai": "^0.2.8",
|
30
32
|
"@langchain/groq": "^0.2.2",
|
31
|
-
"@langchain/langgraph": "^0.
|
33
|
+
"@langchain/langgraph": "^0.3.1",
|
34
|
+
"@langchain/mcp-adapters": "^0.5.2",
|
35
|
+
"@modelcontextprotocol/server-filesystem": "^2025.3.28",
|
32
36
|
"chalk": "^5.4.1",
|
33
37
|
"commander": "^14.0.0",
|
34
38
|
"uuid": "^11.1.0"
|
35
39
|
},
|
36
40
|
"devDependencies": {
|
37
41
|
"@eslint/js": "^9.26.0",
|
38
|
-
"@types/node": "^22.15.
|
42
|
+
"@types/node": "^22.15.30",
|
39
43
|
"@types/uuid": "^10.0.0",
|
40
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
41
|
-
"@typescript-eslint/parser": "^8.
|
44
|
+
"@typescript-eslint/eslint-plugin": "^8.33.1",
|
45
|
+
"@typescript-eslint/parser": "^8.33.1",
|
42
46
|
"eslint": "^9.26.0",
|
43
47
|
"eslint-config-prettier": "^10.1.5",
|
44
48
|
"eslint-plugin-prettier": "^5.1.3",
|
45
49
|
"globals": "^16.1.0",
|
46
50
|
"prettier": "3.5.3",
|
47
51
|
"typescript": "^5.4.2",
|
48
|
-
"vitest": "^3.
|
52
|
+
"vitest": "^3.2.2"
|
49
53
|
},
|
50
54
|
"imports": {
|
51
55
|
"#src/*.js": "./dist/*.js"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Command } from 'commander';
|
2
|
-
import { readBackstory, readGuidelines } from '#src/prompt.js';
|
2
|
+
import { readBackstory, readGuidelines, readSystemPrompt } from '#src/prompt.js';
|
3
3
|
import { readMultipleFilesFromCurrentDir } from '#src/utils.js';
|
4
|
-
import { initConfig
|
4
|
+
import { initConfig } from '#src/config.js';
|
5
5
|
import { getStringFromStdin } from '#src/systemUtils.js';
|
6
6
|
|
7
7
|
interface AskCommandOptions {
|
@@ -22,8 +22,12 @@ export function askCommand(program: Command): void {
|
|
22
22
|
'Input files. Content of these files will be added BEFORE the message'
|
23
23
|
)
|
24
24
|
.action(async (message: string, options: AskCommandOptions) => {
|
25
|
-
await initConfig();
|
26
|
-
const
|
25
|
+
const config = await initConfig();
|
26
|
+
const systemPrompt = readSystemPrompt();
|
27
|
+
const preamble = [readBackstory(), readGuidelines(config.projectGuidelines)];
|
28
|
+
if (systemPrompt) {
|
29
|
+
preamble.push(systemPrompt);
|
30
|
+
}
|
27
31
|
const content = [];
|
28
32
|
if (options.file) {
|
29
33
|
content.push(readMultipleFilesFromCurrentDir(options.file));
|
@@ -42,6 +46,6 @@ export function askCommand(program: Command): void {
|
|
42
46
|
}
|
43
47
|
|
44
48
|
const { askQuestion } = await import('#src/modules/questionAnsweringModule.js');
|
45
|
-
await askQuestion('ASK', preamble.join('\n'), content.join('\n'));
|
49
|
+
await askQuestion('ASK', preamble.join('\n'), content.join('\n'), config);
|
46
50
|
});
|
47
51
|
}
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import type { SlothConfig } from '#src/config.js';
|
2
|
+
import { displayError } from '#src/consoleUtils.js';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Requirements providers. Expected to be in `.providers/` dir.
|
6
|
+
* Aliases are mapped to actual providers in this file
|
7
|
+
*/
|
8
|
+
export const REQUIREMENTS_PROVIDERS = {
|
9
|
+
'jira-legacy': 'jiraIssueLegacyProvider.js',
|
10
|
+
jira: 'jiraIssueProvider.js',
|
11
|
+
github: 'ghIssueProvider.js',
|
12
|
+
text: 'text.js',
|
13
|
+
file: 'file.js',
|
14
|
+
} as const;
|
15
|
+
|
16
|
+
export type RequirementsProviderType = keyof typeof REQUIREMENTS_PROVIDERS;
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Content providers. Expected to be in `.providers/` dir.
|
20
|
+
* Aliases are mapped to actual providers in this file
|
21
|
+
*/
|
22
|
+
export const CONTENT_PROVIDERS = {
|
23
|
+
github: 'ghPrDiffProvider.js',
|
24
|
+
text: 'text.js',
|
25
|
+
file: 'file.js',
|
26
|
+
} as const;
|
27
|
+
|
28
|
+
export type ContentProviderType = keyof typeof CONTENT_PROVIDERS;
|
29
|
+
|
30
|
+
export async function getRequirementsFromProvider(
|
31
|
+
requirementsProvider: RequirementsProviderType | undefined,
|
32
|
+
requirementsId: string | undefined,
|
33
|
+
config: SlothConfig
|
34
|
+
): Promise<string> {
|
35
|
+
return getFromProvider(
|
36
|
+
requirementsProvider,
|
37
|
+
requirementsId,
|
38
|
+
(config?.requirementsProviderConfig ?? {})[requirementsProvider as string],
|
39
|
+
REQUIREMENTS_PROVIDERS
|
40
|
+
);
|
41
|
+
}
|
42
|
+
|
43
|
+
export async function getContentFromProvider(
|
44
|
+
contentProvider: ContentProviderType | undefined,
|
45
|
+
contentId: string | undefined,
|
46
|
+
config: SlothConfig
|
47
|
+
): Promise<string> {
|
48
|
+
return getFromProvider(
|
49
|
+
contentProvider,
|
50
|
+
contentId,
|
51
|
+
(config?.contentProviderConfig ?? {})[contentProvider as string],
|
52
|
+
CONTENT_PROVIDERS
|
53
|
+
);
|
54
|
+
}
|
55
|
+
|
56
|
+
async function getFromProvider(
|
57
|
+
provider: RequirementsProviderType | ContentProviderType | undefined,
|
58
|
+
id: string | undefined,
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
60
|
+
config: any,
|
61
|
+
legitPredefinedProviders: typeof REQUIREMENTS_PROVIDERS | typeof CONTENT_PROVIDERS
|
62
|
+
): Promise<string> {
|
63
|
+
if (typeof provider === 'string') {
|
64
|
+
// Use one of the predefined providers
|
65
|
+
if (legitPredefinedProviders[provider as keyof typeof legitPredefinedProviders]) {
|
66
|
+
const providerPath = `#src/providers/${legitPredefinedProviders[provider as keyof typeof legitPredefinedProviders]}`;
|
67
|
+
const { get } = await import(providerPath);
|
68
|
+
return await get(config, id);
|
69
|
+
} else {
|
70
|
+
displayError(`Unknown provider: ${provider}. Continuing without it.`);
|
71
|
+
}
|
72
|
+
} else if (typeof provider === 'function') {
|
73
|
+
// Type assertion to handle function call
|
74
|
+
return await (provider as (id: string | undefined) => Promise<string>)(id);
|
75
|
+
}
|
76
|
+
return '';
|
77
|
+
}
|
File without changes
|