gaunt-sloth-assistant 0.2.2 → 0.3.0
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.preamble.review.md → .gsloth.guidelines.md} +0 -8
- package/.gsloth.review.md +7 -0
- package/README.md +1 -1
- package/dist/commands/askCommand.js +5 -4
- package/dist/commands/askCommand.js.map +1 -1
- package/dist/commands/reviewCommand.js +22 -8
- package/dist/commands/reviewCommand.js.map +1 -1
- package/dist/config.d.ts +8 -4
- package/dist/config.js +8 -6
- package/dist/config.js.map +1 -1
- package/dist/configs/anthropic.d.ts +2 -3
- package/dist/configs/anthropic.js.map +1 -1
- package/dist/configs/vertexai.d.ts +2 -2
- package/dist/configs/vertexai.js.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/llmUtils.d.ts +4 -0
- package/dist/llmUtils.js +39 -0
- package/dist/llmUtils.js.map +1 -0
- package/dist/modules/questionAnsweringModule.d.ts +0 -11
- package/dist/modules/questionAnsweringModule.js +4 -43
- package/dist/modules/questionAnsweringModule.js.map +1 -1
- package/dist/modules/reviewModule.d.ts +0 -3
- package/dist/modules/reviewModule.js +3 -34
- package/dist/modules/reviewModule.js.map +1 -1
- package/dist/prompt.d.ts +3 -2
- package/dist/prompt.js +25 -12
- package/dist/prompt.js.map +1 -1
- package/dist/systemUtils.d.ts +10 -0
- package/dist/systemUtils.js +34 -0
- package/dist/systemUtils.js.map +1 -1
- package/dist/utils.d.ts +5 -5
- package/dist/utils.js +45 -39
- package/dist/utils.js.map +1 -1
- package/docs/CONFIGURATION.md +4 -4
- package/docs/RELEASE-HOWTO.md +6 -0
- package/gth-ASK-2025-05-16T14-11-39.md +3 -0
- package/gth-ASK-2025-05-16T14-18-27.md +3 -0
- package/gth-ASK-2025-05-16T14-18-56.md +1 -0
- package/gth-ASK-2025-05-16T14-41-20.md +3 -0
- package/gth-ASK-2025-05-16T14-43-31.md +51 -0
- package/gth-ASK-2025-05-16T16-05-52.md +62 -0
- package/gth-DIFF-review-2025-05-16T16-07-53.md +56 -0
- package/gth-DIFF-review-2025-05-16T16-18-55.md +292 -0
- package/package.json +1 -1
- package/src/commands/askCommand.ts +5 -4
- package/src/commands/reviewCommand.ts +23 -9
- package/src/config.ts +15 -12
- package/src/configs/anthropic.ts +5 -3
- package/src/configs/vertexai.ts +2 -2
- package/src/index.ts +12 -3
- package/src/llmUtils.ts +54 -0
- package/src/modules/questionAnsweringModule.ts +6 -59
- package/src/modules/reviewModule.ts +3 -53
- package/src/prompt.ts +32 -17
- package/src/systemUtils.ts +38 -0
- package/src/utils.ts +49 -42
package/dist/prompt.js
CHANGED
@@ -1,17 +1,30 @@
|
|
1
|
-
import {
|
2
|
-
import { GSLOTH_BACKSTORY } from '#src/config.js';
|
3
|
-
import { readFileSyncWithMessages, spawnCommand } from '#src/utils.js';
|
1
|
+
import { readFileFromCurrentDir, readFileFromCurrentOrInstallDir, spawnCommand, } from '#src/utils.js';
|
4
2
|
import { displayError } from '#src/consoleUtils.js';
|
5
|
-
import { exit
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
import { exit } from '#src/systemUtils.js';
|
4
|
+
import { GSLOTH_BACKSTORY } from '#src/config.js';
|
5
|
+
export function readBackstory() {
|
6
|
+
return readFileFromCurrentOrInstallDir(GSLOTH_BACKSTORY, true);
|
7
|
+
}
|
8
|
+
export function readGuidelines(guidelinesFilename) {
|
9
|
+
try {
|
10
|
+
return readFileFromCurrentDir(guidelinesFilename);
|
11
|
+
}
|
12
|
+
catch (error) {
|
13
|
+
displayError('Consider running `gsloth init` to set up your project. Check `gsloth init --help` to see options.');
|
14
|
+
throw error;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
export function readReviewInstructions(reviewInstructions) {
|
18
|
+
return readConfigPromptFile(reviewInstructions);
|
10
19
|
}
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
20
|
+
function readConfigPromptFile(guidelinesFilename) {
|
21
|
+
try {
|
22
|
+
return readFileFromCurrentOrInstallDir(guidelinesFilename);
|
23
|
+
}
|
24
|
+
catch (error) {
|
25
|
+
displayError('Consider running `gsloth init` to set up your project. Check `gsloth init --help` to see options.');
|
26
|
+
throw error;
|
27
|
+
}
|
15
28
|
}
|
16
29
|
/**
|
17
30
|
* This function expects https://cli.github.com/ to be installed and authenticated.
|
package/dist/prompt.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,
|
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,gBAAgB,CAAC;AAElD,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,OAAO,sBAAsB,CAAC,kBAAkB,CAAC,CAAC;IACpD,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,SAAS,oBAAoB,CAAC,kBAA0B;IACtD,IAAI,CAAC;QACH,OAAO,+BAA+B,CAAC,kBAAkB,CAAC,CAAC;IAC7D,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/systemUtils.d.ts
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
+
import { Command } from 'commander';
|
1
2
|
export declare const getCurrentDir: () => string;
|
2
3
|
export declare const getInstallDir: () => string;
|
4
|
+
/**
|
5
|
+
* Cached string from stdin. Should only be called after readStdin completes execution.
|
6
|
+
*/
|
7
|
+
export declare const getStringFromStdin: () => string;
|
3
8
|
export declare const exit: (code?: number) => never;
|
4
9
|
export declare const stdin: NodeJS.ReadStream & {
|
5
10
|
fd: 0;
|
@@ -15,6 +20,11 @@ export declare const env: NodeJS.ProcessEnv;
|
|
15
20
|
* This is called from index.js root entry point.
|
16
21
|
*/
|
17
22
|
export declare const setEntryPoint: (indexJs: string) => void;
|
23
|
+
/**
|
24
|
+
* Asynchronously reads the stdin and stores it as a string,
|
25
|
+
* it can later be retrieved with getStringFromStdin.
|
26
|
+
*/
|
27
|
+
export declare function readStdin(program: Command): Promise<void>;
|
18
28
|
export declare const log: (message: string) => void;
|
19
29
|
export declare const error: (message: string) => void;
|
20
30
|
export declare const warn: (message: string) => void;
|
package/dist/systemUtils.js
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
import { dirname, resolve } from 'node:path';
|
2
2
|
import { fileURLToPath } from 'url';
|
3
|
+
import { ProgressIndicator } from '#src/utils.js';
|
3
4
|
const innerState = {
|
4
5
|
installDir: undefined,
|
6
|
+
stringFromStdin: '',
|
5
7
|
};
|
6
8
|
// Process-related functions and objects
|
7
9
|
export const getCurrentDir = () => process.cwd();
|
@@ -11,6 +13,12 @@ export const getInstallDir = () => {
|
|
11
13
|
}
|
12
14
|
throw new Error('Install directory not set');
|
13
15
|
};
|
16
|
+
/**
|
17
|
+
* Cached string from stdin. Should only be called after readStdin completes execution.
|
18
|
+
*/
|
19
|
+
export const getStringFromStdin = () => {
|
20
|
+
return innerState.stringFromStdin;
|
21
|
+
};
|
14
22
|
export const exit = (code) => process.exit(code || 0);
|
15
23
|
export const stdin = process.stdin;
|
16
24
|
export const stdout = process.stdout;
|
@@ -27,6 +35,32 @@ export const setEntryPoint = (indexJs) => {
|
|
27
35
|
const dirPath = dirname(filePath);
|
28
36
|
innerState.installDir = resolve(dirPath);
|
29
37
|
};
|
38
|
+
/**
|
39
|
+
* Asynchronously reads the stdin and stores it as a string,
|
40
|
+
* it can later be retrieved with getStringFromStdin.
|
41
|
+
*/
|
42
|
+
export function readStdin(program) {
|
43
|
+
return new Promise((resolvePromise) => {
|
44
|
+
if (stdin.isTTY) {
|
45
|
+
program.parseAsync().then(() => resolvePromise());
|
46
|
+
}
|
47
|
+
else {
|
48
|
+
// Support piping diff into gsloth
|
49
|
+
const progressIndicator = new ProgressIndicator('reading STDIN', true);
|
50
|
+
stdin.on('readable', function () {
|
51
|
+
const chunk = this.read();
|
52
|
+
progressIndicator.indicate();
|
53
|
+
if (chunk !== null) {
|
54
|
+
const chunkStr = chunk.toString('utf8');
|
55
|
+
innerState.stringFromStdin = innerState.stringFromStdin + chunkStr;
|
56
|
+
}
|
57
|
+
});
|
58
|
+
stdin.on('end', function () {
|
59
|
+
program.parseAsync(argv).then(() => resolvePromise());
|
60
|
+
});
|
61
|
+
}
|
62
|
+
});
|
63
|
+
}
|
30
64
|
// Console-related functions
|
31
65
|
export const log = (message) => console.log(message);
|
32
66
|
export const error = (message) => console.error(message);
|
package/dist/systemUtils.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"systemUtils.js","sourceRoot":"","sources":["../src/systemUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;
|
1
|
+
{"version":3,"file":"systemUtils.js","sourceRoot":"","sources":["../src/systemUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAgBlD,MAAM,UAAU,GAAe;IAC7B,UAAU,EAAE,SAAS;IACrB,eAAe,EAAE,EAAE;CACpB,CAAC;AAEF,wCAAwC;AACxC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;AACzD,MAAM,CAAC,MAAM,aAAa,GAAG,GAAW,EAAE;IACxC,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC;QAC1B,OAAO,UAAU,CAAC,UAAU,CAAC;IAC/B,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAC/C,CAAC,CAAC;AACF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAW,EAAE;IAC7C,OAAO,UAAU,CAAC,eAAe,CAAC;AACpC,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAa,EAAS,EAAE,CAAC,OA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AG,QAAQ,CAAC;gBACrE,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;gBACd,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC,CAAC;YACxD,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC;AAED,4BAA4B;AAC5B,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,OAAe,EAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC"}
|
package/dist/utils.d.ts
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
import { SlothConfig } from '#src/config.js';
|
2
|
-
import { Command } from 'commander';
|
3
2
|
export declare function toFileSafeString(string: string): string;
|
4
3
|
export declare function fileSafeLocalDate(): string;
|
5
4
|
export declare function readFileFromCurrentDir(fileName: string): string;
|
5
|
+
export declare function readFileFromCurrentOrInstallDir(filePath: string, silentCurrent?: boolean): string;
|
6
6
|
export declare function writeFileIfNotExistsWithMessages(filePath: string, content: string): void;
|
7
7
|
export declare function readFileSyncWithMessages(filePath: string, errorMessageIn?: string, noFileMessage?: string): string;
|
8
|
-
export declare function readStdin(program: Command): Promise<void>;
|
9
8
|
export declare function spawnCommand(command: string, args: string[], progressMessage: string, successMessage: string): Promise<string>;
|
10
9
|
export declare function getSlothVersion(): string;
|
11
10
|
export declare class ProgressIndicator {
|
12
|
-
private
|
13
|
-
|
14
|
-
|
11
|
+
private interval;
|
12
|
+
constructor(initialMessage: string, manual?: boolean);
|
13
|
+
private indicateInner;
|
15
14
|
indicate(): void;
|
15
|
+
stop(): void;
|
16
16
|
}
|
17
17
|
interface LLMOutput {
|
18
18
|
messages: Array<{
|
package/dist/utils.js
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
import { display, displayError, displaySuccess, displayWarning } from '#src/consoleUtils.js';
|
2
2
|
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
3
|
-
import { slothContext } from '#src/config.js';
|
4
3
|
import { resolve } from 'node:path';
|
5
4
|
import { spawn } from 'node:child_process';
|
6
|
-
import {
|
5
|
+
import { getCurrentDir, getInstallDir, stdout } from '#src/systemUtils.js';
|
7
6
|
import url from 'node:url';
|
8
7
|
export function toFileSafeString(string) {
|
9
8
|
return string.replace(/[^A-Za-z0-9]/g, '-');
|
@@ -20,9 +19,33 @@ export function fileSafeLocalDate() {
|
|
20
19
|
export function readFileFromCurrentDir(fileName) {
|
21
20
|
const currentDir = getCurrentDir();
|
22
21
|
const filePath = resolve(currentDir, fileName);
|
23
|
-
display(`Reading file ${
|
22
|
+
display(`Reading file ${filePath}...`);
|
24
23
|
return readFileSyncWithMessages(filePath);
|
25
24
|
}
|
25
|
+
export function readFileFromCurrentOrInstallDir(filePath, silentCurrent) {
|
26
|
+
const currentDir = getCurrentDir();
|
27
|
+
const currentFilePath = resolve(currentDir, filePath);
|
28
|
+
if (!silentCurrent) {
|
29
|
+
display(`Reading file ${currentFilePath}...`);
|
30
|
+
}
|
31
|
+
try {
|
32
|
+
return readFileSync(currentFilePath, { encoding: 'utf8' });
|
33
|
+
}
|
34
|
+
catch (_error) {
|
35
|
+
if (!silentCurrent) {
|
36
|
+
display(`The ${currentFilePath} not found or can\'t be read, trying install directory...`);
|
37
|
+
}
|
38
|
+
const installDir = getInstallDir();
|
39
|
+
const installFilePath = resolve(installDir, filePath);
|
40
|
+
try {
|
41
|
+
return readFileSync(installFilePath, { encoding: 'utf8' });
|
42
|
+
}
|
43
|
+
catch (readFromInstallDirError) {
|
44
|
+
displayError(`The ${installFilePath} not found or can\'t be read.`);
|
45
|
+
throw readFromInstallDirError;
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
26
49
|
export function writeFileIfNotExistsWithMessages(filePath, content) {
|
27
50
|
display(`checking ${filePath} existence`);
|
28
51
|
if (!existsSync(filePath)) {
|
@@ -46,36 +69,12 @@ export function readFileSyncWithMessages(filePath, errorMessageIn, noFileMessage
|
|
46
69
|
else {
|
47
70
|
displayError(error.message);
|
48
71
|
}
|
49
|
-
|
50
|
-
throw error; // This line will never be reached due to exit(1), but satisfies TypeScript
|
72
|
+
throw error;
|
51
73
|
}
|
52
74
|
}
|
53
|
-
export function readStdin(program) {
|
54
|
-
return new Promise((resolvePromise) => {
|
55
|
-
if (stdin.isTTY) {
|
56
|
-
program.parseAsync().then(() => resolvePromise());
|
57
|
-
}
|
58
|
-
else {
|
59
|
-
// Support piping diff into gsloth
|
60
|
-
const progressIndicator = new ProgressIndicator('reading STDIN');
|
61
|
-
progressIndicator.indicate();
|
62
|
-
stdin.on('readable', function () {
|
63
|
-
const chunk = this.read();
|
64
|
-
progressIndicator.indicate();
|
65
|
-
if (chunk !== null) {
|
66
|
-
const chunkStr = chunk.toString('utf8');
|
67
|
-
slothContext.stdin = slothContext.stdin + chunkStr;
|
68
|
-
}
|
69
|
-
});
|
70
|
-
stdin.on('end', function () {
|
71
|
-
program.parseAsync(argv).then(() => resolvePromise());
|
72
|
-
});
|
73
|
-
}
|
74
|
-
});
|
75
|
-
}
|
76
75
|
export async function spawnCommand(command, args, progressMessage, successMessage) {
|
77
76
|
return new Promise((resolve, reject) => {
|
78
|
-
const progressIndicator = new ProgressIndicator(progressMessage);
|
77
|
+
const progressIndicator = new ProgressIndicator(progressMessage, true);
|
79
78
|
const out = { stdout: '', stderr: '' };
|
80
79
|
const spawned = spawn(command, args);
|
81
80
|
spawned.stdout.on('data', async (stdoutChunk) => {
|
@@ -109,20 +108,27 @@ export function getSlothVersion() {
|
|
109
108
|
return JSON.parse(projectJson).version;
|
110
109
|
}
|
111
110
|
export class ProgressIndicator {
|
112
|
-
|
113
|
-
initialMessage
|
114
|
-
|
115
|
-
|
116
|
-
|
111
|
+
interval = undefined;
|
112
|
+
constructor(initialMessage, manual) {
|
113
|
+
stdout.write(initialMessage);
|
114
|
+
if (!manual) {
|
115
|
+
this.interval = setInterval(this.indicateInner, 1000);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
indicateInner() {
|
119
|
+
stdout.write('.');
|
117
120
|
}
|
118
121
|
indicate() {
|
119
|
-
if (this.
|
120
|
-
|
122
|
+
if (this.interval) {
|
123
|
+
throw new Error('ProgressIndicator.indicate only to be called in manual mode');
|
121
124
|
}
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
+
this.indicateInner();
|
126
|
+
}
|
127
|
+
stop() {
|
128
|
+
if (this.interval) {
|
129
|
+
clearInterval(this.interval);
|
125
130
|
}
|
131
|
+
stdout.write('\n');
|
126
132
|
}
|
127
133
|
}
|
128
134
|
/**
|
package/dist/utils.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,cA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AG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;QACjD,OAAO,GAAG,QAAQ,cAAc,OAAO,UAAU,CAAC;IACpD,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACpD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACtC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,CAAC,KAAK,CAAC,CAAC;gBACd,OAAO;YACT,CAAC;YACD,IAAI,MAAM,EAAE,CAAC;gBACX,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC1B,OAAO;YACT,CAAC;YACD,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/docs/CONFIGURATION.md
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# Configuration
|
2
2
|
|
3
|
-
Populate `.gsloth.
|
3
|
+
Populate `.gsloth.guidelines.md` with your project details and quality requirements.
|
4
4
|
Proper preamble is a paramount for good inference.
|
5
|
-
Check [.gsloth.
|
5
|
+
Check [.gsloth.guidelines.md](../.gsloth.guidelines.md) for example.
|
6
6
|
|
7
7
|
Your project should have the following files in order for gsloth to function:
|
8
8
|
- Configuration file (one of):
|
9
9
|
- `.gsloth.config.js` (JavaScript module)
|
10
10
|
- `.gsloth.config.json` (JSON file)
|
11
11
|
- `.gsloth.config.mjs` (JavaScript module with explicit module extension)
|
12
|
-
- `.gsloth.
|
12
|
+
- `.gsloth.guidelines.md`
|
13
13
|
|
14
|
-
> Gaunt Sloth currently only functions from the directory which has one of the configuration files and `.gsloth.
|
14
|
+
> Gaunt Sloth currently only functions from the directory which has one of the configuration files and `.gsloth.guidelines.md`.
|
15
15
|
> Global configuration to invoke gsloth anywhere is in [ROADMAP](../ROADMAP.md).
|
16
16
|
|
17
17
|
## Config initialization
|
package/docs/RELEASE-HOWTO.md
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
✅ Understood. I am ready for your programming-related inquiries. Please state your requirements.
|
@@ -0,0 +1,51 @@
|
|
1
|
+
This `package.json` file is reasonably well-structured. I have a few observations:
|
2
|
+
|
3
|
+
* ✅ **`name`, `version`, `license`, `author`, `type`, `main`, `repository`**: These fields are correctly defined. Using `"type": "module"` is a modern choice.
|
4
|
+
* ✅ **`engines`**: Clearly specifies Node.js `>=22.0.0` and npm `>=10.9.0`. These are very recent versions, which is a deliberate choice that limits broader compatibility but ensures usage of newer features.
|
5
|
+
* ✅ **`scripts`**:
|
6
|
+
* `build`, `lint`, `format`: Standard and appropriate.
|
7
|
+
* `test`: `"npm run build && vitest run"` is good practice, ensuring tests run against the compiled output.
|
8
|
+
* `prepare`: `"npm run build"` is also standard, ensuring the package is built after installation and before publishing.
|
9
|
+
* ✅ **`dependencies`** and **`devDependencies`**: The listed packages are appropriate for the described functionality (Langchain, CLI tools) and development (TypeScript, ESLint, Prettier, Vitest). Versions are up-to-date.
|
10
|
+
* ✅ **`imports`**: The subpath import `"#src/*.js": "./dist/*.js"` is a modern way to define internal package aliases.
|
11
|
+
* ⚠️ For a smoother development experience with TypeScript, ensure your `tsconfig.json` has a corresponding `paths` alias, for example:
|
12
|
+
```json
|
13
|
+
{
|
14
|
+
"compilerOptions": {
|
15
|
+
"baseUrl": ".", // Or "./src"
|
16
|
+
"paths": {
|
17
|
+
"#src/*": ["src/*"] // Or just "*" if baseUrl is "./src"
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
```
|
22
|
+
This allows TypeScript to resolve `#src/...` imports to your source files during development and type-checking.
|
23
|
+
|
24
|
+
Now, for more critical points:
|
25
|
+
|
26
|
+
* ❌ **`bin` configuration**:
|
27
|
+
```json
|
28
|
+
"bin": {
|
29
|
+
"gsloth": "index.js",
|
30
|
+
"gth": "index.js"
|
31
|
+
}
|
32
|
+
```
|
33
|
+
Your `main` field is `"dist/index.js"`, indicating that your compiled, runnable JavaScript code resides in the `dist` directory. However, your `bin` entries point to `index.js` in the project root.
|
34
|
+
If `index.js` in the root is your TypeScript source file (or does not exist), this will not work when the package is installed globally or used via `npx`. The `bin` entries should point to the executable JavaScript files generated by your build process.
|
35
|
+
Typically, this would be something like:
|
36
|
+
```json
|
37
|
+
"bin": {
|
38
|
+
"gsloth": "dist/index.js", // Or a specific CLI entry point like "dist/cli.js"
|
39
|
+
"gth": "dist/index.js" // Same here
|
40
|
+
}
|
41
|
+
```
|
42
|
+
The target file (e.g., `dist/index.js` or `dist/cli.js`) must be executable and should start with a shebang line (e.g., `#!/usr/bin/env node`). If your main TypeScript entry point (e.g., `src/index.ts` or `src/cli.ts`) includes this shebang, `tsc` usually preserves it in the output JavaScript file.
|
43
|
+
|
44
|
+
* ⚠️ **`description`**: The `description` field is empty.
|
45
|
+
```json
|
46
|
+
"description": "",
|
47
|
+
```
|
48
|
+
Providing a concise description is highly recommended. It improves the package's discoverability on npm and helps users understand its purpose quickly.
|
49
|
+
|
50
|
+
In summary:
|
51
|
+
The most critical issue is the `bin` configuration, which likely needs to be updated to point to files within your `dist` directory. The empty `description` is a minor omission. The `imports` setup is good, but ensure your TypeScript configuration complements it for development.
|
@@ -0,0 +1,62 @@
|
|
1
|
+
Okay, I've reviewed your `package.json` file. Here's my assessment:
|
2
|
+
|
3
|
+
## `package.json` Review
|
4
|
+
|
5
|
+
Overall, this `package.json` is well-structured and sets up a modern Node.js TypeScript project with appropriate tooling for LangChain/LangGraph development. However, there are a few points to address.
|
6
|
+
|
7
|
+
### ✅ Positive Aspects
|
8
|
+
|
9
|
+
* **Modern Node.js Setup**:
|
10
|
+
* `"type": "module"`: Correctly enables ES module syntax.
|
11
|
+
* `"engines"`: Specifying Node.js (`>=22.0.0`) and npm (`>=10.9.0`) versions is good practice for ensuring environment compatibility.
|
12
|
+
* **Build and Development Scripts**:
|
13
|
+
* `"build": "tsc"`: Standard TypeScript compilation.
|
14
|
+
* `"test": "npm run build && vitest run"`: Ensures code is built before tests run. `vitest` is a good choice for a modern testing framework.
|
15
|
+
* `"lint": "eslint . --ext .js,.ts"`: Proper linting setup.
|
16
|
+
* `"format": "prettier --write 'src/**/*.{js,ts}'"`: Standard code formatting.
|
17
|
+
* `"prepare": "npm run build"`: Excellent practice to ensure the project is built after installation, making it ready for use, especially if it's a library or a CLI tool.
|
18
|
+
* **Dependencies**:
|
19
|
+
* The LangChain/LangGraph dependencies (`@langchain/anthropic`, `@langchain/core`, `@langchain/google-vertexai`, `@langchain/groq`, `@langchain/langgraph`) are correctly listed. Using `^` for versioning allows for non-breaking updates.
|
20
|
+
* Utility dependencies like `chalk`, `commander`, and `uuid` are appropriate for a CLI/assistant type of project.
|
21
|
+
* **Dev Dependencies**:
|
22
|
+
* A comprehensive set of development tools is included: TypeScript, ESLint (with TypeScript and Prettier plugins), Prettier, and type definitions (`@types/node`, `@types/uuid`).
|
23
|
+
* **Subpath Imports**:
|
24
|
+
* `"imports": { "#src/*.js": "./dist/*.js" }`: This is a good use of Node.js subpath imports, allowing for cleaner import statements within your compiled code (e.g., `import ... from '#src/module.js'`).
|
25
|
+
|
26
|
+
### ⚠️ Areas for Improvement / Potential Issues
|
27
|
+
|
28
|
+
* **Missing Description**:
|
29
|
+
* The `"description"` field is empty. It's good practice to provide a brief description of your package. This is helpful for `npm search` and general understanding.
|
30
|
+
* **Recommendation**: Add a concise description.
|
31
|
+
* **`globals` Dependency**:
|
32
|
+
* The `globals` package is listed in `devDependencies`. While it can be used to define global variables for ESLint, modern ESLint configurations (especially with `@eslint/js` and `@typescript-eslint/parser`) often handle this directly within the ESLint configuration file (e.g., `env` or `globals` sections in `.eslintrc.js`).
|
33
|
+
* **Recommendation**: Verify if this dependency is actively used and necessary. If your ESLint configuration handles globals sufficiently, this might be redundant.
|
34
|
+
|
35
|
+
### ❌ Critical Issues
|
36
|
+
|
37
|
+
* **Incorrect `bin` Path(s)**:
|
38
|
+
* The `"bin"` field defines CLI commands:
|
39
|
+
```json
|
40
|
+
"bin": {
|
41
|
+
"gsloth": "index.js",
|
42
|
+
"gth": "index.js"
|
43
|
+
}
|
44
|
+
```
|
45
|
+
* However, your `"main"` field is `"dist/index.js"`, and your build script (`tsc`) compiles TypeScript from `src` to `dist`. This strongly suggests that the executable entry point for your CLI should be within the `dist` directory (likely `dist/index.js` or a specific CLI entry file in `dist`).
|
46
|
+
* Pointing `bin` to `index.js` in the project root will either:
|
47
|
+
1. Fail if `index.js` doesn't exist or isn't executable.
|
48
|
+
2. Run the wrong (uncompiled or placeholder) code if an `index.js` exists in the root but isn't the intended compiled entry point.
|
49
|
+
* **Recommendation**: Change the `bin` paths to point to the compiled JavaScript entry file. For example:
|
50
|
+
```json
|
51
|
+
"bin": {
|
52
|
+
"gsloth": "dist/index.js",
|
53
|
+
"gth": "dist/index.js"
|
54
|
+
}
|
55
|
+
```
|
56
|
+
Or, if you have a dedicated CLI entry point, adjust accordingly (e.g., `dist/cli.js`). Ensure the target file has a shebang (e.g., `#!/usr/bin/env node`) if it's meant to be directly executable.
|
57
|
+
|
58
|
+
### Summary
|
59
|
+
|
60
|
+
The `package.json` is largely well-configured for a TypeScript-based LangChain/LangGraph project. The most critical issue to address is the `bin` path configuration to ensure your CLI commands work correctly after installation. The other points are minor improvements.
|
61
|
+
|
62
|
+
Please provide the actual code files (TypeScript/JavaScript) when you're ready for a review of the LangChain/LangGraph logic itself.
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Greetings. I have reviewed the submitted diff. The changes introduce significant architectural improvements, enhance configuration flexibility, and refine the user experience.
|
2
|
+
|
3
|
+
Here is my assessment:
|
4
|
+
|
5
|
+
**Architectural and Flow Improvements:**
|
6
|
+
* ✅ The introduction of `src/llmUtils.ts` is a commendable refactoring. Centralizing the LangChain/LangGraph LLM invocation logic into a reusable `invoke` function simplifies the `questionAnsweringModule` and `reviewModule` considerably. This promotes the DRY principle and makes the core LLM interaction logic easier to manage and test.
|
7
|
+
* ✅ The use of `StateGraph`, `MessagesAnnotation`, and `MemorySaver` from `@langchain/langgraph` within `llmUtils.ts` is appropriate for managing the LLM interaction state.
|
8
|
+
* ✅ The separation of prompt concerns into distinct files (`.gsloth.backstory.md`, `.gsloth.guidelines.md`, `.gsloth.review.md`) and corresponding loader functions (`readBackstory`, `readGuidelines`, `readReviewInstructions`) in `src/prompt.ts` provides better organization and clarity for prompt engineering.
|
9
|
+
* ✅ Handling of standard input (`stdin`) has been cleanly moved to `src/systemUtils.ts` and cached, which is a more logical placement.
|
10
|
+
|
11
|
+
**Configuration Enhancements:**
|
12
|
+
* ✅ The `SlothConfig` interface and default configurations in `src/config.ts` have been updated to include `projectGuidelines` and `projectReviewInstructions`. This allows for more tailored prompting.
|
13
|
+
* ✅ The type hint for the LLM instance in `SlothConfig` has been refined from `LanguageModelLike` to the more specific `BaseChatModel`.
|
14
|
+
* ✅ Documentation (`README.md`, `docs/CONFIGURATION.md`) and initialization logic (`initCommand`) have been updated to reflect the new configuration file names (e.g., `.gsloth.guidelines.md`).
|
15
|
+
|
16
|
+
**Code Quality and Testing:**
|
17
|
+
* ✅ Test suites (`*.spec.ts`) have been diligently updated to reflect the refactoring. Mocks are handled more cleanly (e.g., top-level `vi.mock`), and tests cover the new `llmUtils.ts` and changes in existing modules.
|
18
|
+
* ✅ The new output file prefix `gth-` (e.g., `gth-ASK`, `gth-DIFF-review`) is consistently applied across the codebase and tests, and is now included in `.gitignore`.
|
19
|
+
* ✅ TypeScript types are used effectively, and improvements have been made (e.g., `BaseChatModel`).
|
20
|
+
* ✅ The new global `--verbose` option in `src/index.ts` for enabling detailed LLM prompt logging is a useful debugging feature.
|
21
|
+
|
22
|
+
**User Experience:**
|
23
|
+
* ✅ The `ProgressIndicator` in `src/utils.ts` has been significantly improved. It now provides continuous feedback for long-running operations by default and includes a `stop()` method for clean termination. It also supports a manual indication mode.
|
24
|
+
|
25
|
+
**Specific Feedback & Suggestions:**
|
26
|
+
|
27
|
+
* ⚠️ **Security Suggestion (Important):** In `src/commands/reviewCommand.ts`, there's a `TODO` comment regarding `prId` sanitization:
|
28
|
+
```typescript
|
29
|
+
// src/commands/reviewCommand.ts
|
30
|
+
// ...
|
31
|
+
// TODO sanitize prId
|
32
|
+
await review(`gth-PR-${prId}-review`, systemMessage.join('\n'), content.join('\n'));
|
33
|
+
```
|
34
|
+
If `prId` can be influenced by user input (e.g., from a command-line argument that might not be strictly numeric or could contain path characters), it's crucial to sanitize it before using it in a filename. This prevents potential path traversal or other file system vulnerabilities. Please ensure `prId` is appropriately validated or sanitized.
|
35
|
+
|
36
|
+
* ✅ **Refactoring of `reviewInner` and `askQuestionInner`:** The logic previously in these internal functions has been effectively moved to the generic `llmUtils.invoke` function. This is a good simplification.
|
37
|
+
|
38
|
+
* ✅ **File Reading Utilities:** The new `readFileFromCurrentOrInstallDir` utility in `src/utils.ts` is a good addition for robustly loading configuration/prompt files.
|
39
|
+
|
40
|
+
* ⚠️ **Nitpick (Minor):** In `src/modules/questionAnsweringModule.ts`, the comment:
|
41
|
+
```typescript
|
42
|
+
// TODO highlight LLM output with something like Prism.JS (maybe system emoj are enough ????????????)
|
43
|
+
```
|
44
|
+
The series of question marks makes it appear less formal than typical `TODO` comments. This is a minor point of style.
|
45
|
+
|
46
|
+
**Overall:**
|
47
|
+
|
48
|
+
The submitted changes are of high quality and represent a significant improvement in the codebase's structure, maintainability, and user experience. The refactoring to centralize LLM interaction is particularly noteworthy.
|
49
|
+
|
50
|
+
---
|
51
|
+
|
52
|
+
**Recommendation:**
|
53
|
+
|
54
|
+
✅ **I recommend approving this PR.**
|
55
|
+
|
56
|
+
The changes are largely excellent. The primary point to consider before merging is the `prId` sanitization mentioned above to ensure robustness against potentially malformed inputs. The other points are minor.
|