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,22 +1,25 @@
|
|
1
|
-
import {
|
1
|
+
import type { SlothConfig } from '#src/config.js';
|
2
2
|
import { display, displayDebug, displayError, displaySuccess } from '#src/consoleUtils.js';
|
3
|
-
import { stdout } from '#src/systemUtils.js';
|
4
3
|
import { generateStandardFileName, ProgressIndicator } from '#src/utils.js';
|
5
4
|
import { writeFileSync } from 'node:fs';
|
6
5
|
import { invoke } from '#src/llmUtils.js';
|
7
6
|
import { getGslothFilePath } from '#src/filePathUtils.js';
|
8
7
|
|
9
|
-
export async function review(
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
export async function review(
|
9
|
+
source: string,
|
10
|
+
preamble: string,
|
11
|
+
diff: string,
|
12
|
+
config: SlothConfig,
|
13
|
+
command: 'pr' | 'review' = 'review'
|
14
|
+
): Promise<void> {
|
15
|
+
const progressIndicator = config.streamOutput ? undefined : new ProgressIndicator('Reviewing.');
|
16
|
+
const outputContent = await invoke(config.llm, preamble, diff, config, command);
|
17
|
+
progressIndicator?.stop();
|
13
18
|
const filename = generateStandardFileName(source);
|
14
19
|
const filePath = getGslothFilePath(filename);
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
// TODO highlight LLM output with something like Prism.JS (maybe system emoj are enough ✅⚠️❌)
|
19
|
-
display(outputContent);
|
20
|
+
if (!config.streamOutput) {
|
21
|
+
display('\n' + outputContent);
|
22
|
+
}
|
20
23
|
try {
|
21
24
|
writeFileSync(filePath, outputContent);
|
22
25
|
displaySuccess(`This report can be found in ${filePath}`);
|
package/src/modules/types.ts
CHANGED
File without changes
|
package/src/prompt.ts
CHANGED
@@ -5,7 +5,7 @@ import {
|
|
5
5
|
} from '#src/utils.js';
|
6
6
|
import { displayError } from '#src/consoleUtils.js';
|
7
7
|
import { exit } from '#src/systemUtils.js';
|
8
|
-
import { GSLOTH_BACKSTORY } from '#src/
|
8
|
+
import { GSLOTH_BACKSTORY, GSLOTH_SYSTEM_PROMPT } from '#src/constants.js';
|
9
9
|
import { getGslothConfigReadPath } from '#src/filePathUtils.js';
|
10
10
|
|
11
11
|
export function readBackstory(): string {
|
@@ -28,6 +28,10 @@ export function readReviewInstructions(reviewInstructions: string): string {
|
|
28
28
|
return readConfigPromptFile(reviewInstructions);
|
29
29
|
}
|
30
30
|
|
31
|
+
export function readSystemPrompt(): string {
|
32
|
+
return readFileFromCurrentOrInstallDir(GSLOTH_SYSTEM_PROMPT, true);
|
33
|
+
}
|
34
|
+
|
31
35
|
function readConfigPromptFile(guidelinesFilename: string): string {
|
32
36
|
try {
|
33
37
|
const filePath = getGslothConfigReadPath(guidelinesFilename);
|
package/src/providers/file.ts
CHANGED
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
|
import type { ProviderConfig } from './types.js';
|
4
4
|
|
5
5
|
/**
|
@@ -19,7 +19,9 @@ export async function get(
|
|
19
19
|
|
20
20
|
try {
|
21
21
|
// Use the GitHub CLI to fetch issue details
|
22
|
+
const progress = new ProgressIndicator(`Fetching GitHub issue #${issueId}`);
|
22
23
|
const issueContent = await execAsync(`gh issue view ${issueId}`);
|
24
|
+
progress.stop();
|
23
25
|
|
24
26
|
if (!issueContent) {
|
25
27
|
displayWarning(`No content found for GitHub issue #${issueId}`);
|
@@ -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
|
import type { ProviderConfig } from './types.js';
|
4
4
|
|
5
5
|
/**
|
@@ -19,7 +19,9 @@ export async function get(
|
|
19
19
|
|
20
20
|
try {
|
21
21
|
// Use the GitHub CLI to fetch PR diff
|
22
|
+
const progress = new ProgressIndicator(`Fetching GitHub PR #${prId} diff`);
|
22
23
|
const prDiffContent = await execAsync(`gh pr diff ${prId}`);
|
24
|
+
progress.stop();
|
23
25
|
|
24
26
|
if (!prDiffContent) {
|
25
27
|
displayWarning(`No diff content found for GitHub PR #${prId}`);
|
File without changes
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { display, displayError, displayWarning } from '#src/consoleUtils.js';
|
2
2
|
import { env } from '#src/systemUtils.js';
|
3
3
|
import type { JiraConfig } from './types.js';
|
4
|
+
import { ProgressIndicator } from '#src/utils.js';
|
4
5
|
|
5
6
|
interface JiraIssueResponse {
|
6
7
|
fields: {
|
@@ -105,7 +106,6 @@ async function getJiraIssue(config: JiraConfig, jiraKey: string): Promise<JiraIs
|
|
105
106
|
if (config.displayUrl) {
|
106
107
|
display(`Loading Jira issue ${config.displayUrl}${jiraKey}`);
|
107
108
|
}
|
108
|
-
display(`Retrieving jira from api ${apiUrl.replace(/^https?:\/\//, '')}`);
|
109
109
|
|
110
110
|
// This filter will be necessary for V3: `&expand=renderedFields` to convert ADF to HTML
|
111
111
|
const filters = '?fields=summary,description'; // Limit JSON to summary and description
|
@@ -122,10 +122,14 @@ async function getJiraIssue(config: JiraConfig, jiraKey: string): Promise<JiraIs
|
|
122
122
|
'Accept-Language': 'en-US,en;q=0.9', // Prevents errors in other languages
|
123
123
|
};
|
124
124
|
|
125
|
+
const progressIndicator = new ProgressIndicator(
|
126
|
+
`Retrieving jira from api ${apiUrl.replace(/^https?:\/\//, '')}`
|
127
|
+
);
|
125
128
|
const response = await fetch(apiUrl + filters, {
|
126
129
|
method: 'GET',
|
127
130
|
headers: headers,
|
128
131
|
});
|
132
|
+
progressIndicator.stop();
|
129
133
|
|
130
134
|
if (!response?.ok) {
|
131
135
|
try {
|
package/src/providers/text.ts
CHANGED
File without changes
|
package/src/providers/types.ts
CHANGED
File without changes
|
package/src/systemUtils.ts
CHANGED
File without changes
|
package/src/utils.ts
CHANGED
File without changes
|
package/tsconfig.json
CHANGED
File without changes
|
package/vitest-it.config.ts
CHANGED
File without changes
|
package/vitest.config.ts
CHANGED
File without changes
|