gaunt-sloth-assistant 0.1.5 → 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/.prettierrc.json +9 -0
- package/README.md +177 -158
- package/ROADMAP.md +1 -1
- package/dist/commands/askCommand.d.ts +6 -0
- package/dist/commands/askCommand.js +27 -0
- package/dist/commands/askCommand.js.map +1 -0
- package/dist/commands/initCommand.d.ts +6 -0
- package/dist/commands/initCommand.js +16 -0
- package/dist/commands/initCommand.js.map +1 -0
- package/dist/commands/reviewCommand.d.ts +3 -0
- package/dist/commands/reviewCommand.js +142 -0
- package/dist/commands/reviewCommand.js.map +1 -0
- package/dist/config.d.ts +84 -0
- package/dist/config.js +180 -0
- package/dist/config.js.map +1 -0
- package/dist/configs/anthropic.d.ts +4 -0
- package/{src → dist}/configs/anthropic.js +45 -48
- package/dist/configs/anthropic.js.map +1 -0
- package/dist/configs/fake.d.ts +3 -0
- package/{src → dist}/configs/fake.js +11 -14
- package/dist/configs/fake.js.map +1 -0
- package/dist/configs/groq.d.ts +4 -0
- package/{src → dist}/configs/groq.js +10 -13
- package/dist/configs/groq.js.map +1 -0
- package/dist/configs/types.d.ts +14 -0
- package/dist/configs/types.js +2 -0
- package/dist/configs/types.js.map +1 -0
- package/dist/configs/vertexai.d.ts +4 -0
- package/{src → dist}/configs/vertexai.js +44 -47
- package/dist/configs/vertexai.js.map +1 -0
- package/dist/consoleUtils.d.ts +6 -0
- package/{src → dist}/consoleUtils.js +10 -15
- package/dist/consoleUtils.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- 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 +7 -0
- package/dist/modules/questionAnsweringModule.js +33 -0
- package/dist/modules/questionAnsweringModule.js.map +1 -0
- package/dist/modules/reviewModule.d.ts +1 -0
- package/dist/modules/reviewModule.js +29 -0
- package/dist/modules/reviewModule.js.map +1 -0
- package/dist/modules/types.d.ts +18 -0
- package/dist/modules/types.js +2 -0
- package/dist/modules/types.js.map +1 -0
- package/dist/prompt.d.ts +8 -0
- package/dist/prompt.js +45 -0
- package/dist/prompt.js.map +1 -0
- package/dist/providers/file.d.ts +8 -0
- package/dist/providers/file.js +20 -0
- package/dist/providers/file.js.map +1 -0
- package/dist/providers/ghPrDiffProvider.d.ts +8 -0
- package/dist/providers/ghPrDiffProvider.js +16 -0
- package/dist/providers/ghPrDiffProvider.js.map +1 -0
- package/dist/providers/jiraIssueLegacyAccessTokenProvider.d.ts +8 -0
- package/dist/providers/jiraIssueLegacyAccessTokenProvider.js +62 -0
- package/dist/providers/jiraIssueLegacyAccessTokenProvider.js.map +1 -0
- package/dist/providers/jiraIssueLegacyProvider.d.ts +8 -0
- package/dist/providers/jiraIssueLegacyProvider.js +74 -0
- package/dist/providers/jiraIssueLegacyProvider.js.map +1 -0
- package/dist/providers/jiraIssueProvider.d.ts +11 -0
- package/dist/providers/jiraIssueProvider.js +96 -0
- package/dist/providers/jiraIssueProvider.js.map +1 -0
- package/dist/providers/text.d.ts +8 -0
- package/dist/providers/text.js +10 -0
- package/dist/providers/text.js.map +1 -0
- package/dist/providers/types.d.ts +21 -0
- package/dist/providers/types.js +2 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/systemUtils.d.ts +32 -0
- package/dist/systemUtils.js +70 -0
- package/dist/systemUtils.js.map +1 -0
- package/dist/utils.d.ts +49 -0
- package/dist/utils.js +192 -0
- package/dist/utils.js.map +1 -0
- package/docs/CONFIGURATION.md +99 -10
- package/docs/RELEASE-HOWTO.md +7 -1
- package/eslint.config.js +99 -21
- 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/index.js +10 -27
- package/package.json +26 -15
- package/src/commands/askCommand.ts +35 -0
- package/src/commands/initCommand.ts +19 -0
- package/src/commands/reviewCommand.ts +223 -0
- package/src/config.ts +269 -0
- package/src/configs/anthropic.ts +57 -0
- package/src/configs/fake.ts +15 -0
- package/src/configs/groq.ts +54 -0
- package/src/configs/vertexai.ts +53 -0
- package/src/consoleUtils.ts +33 -0
- package/src/index.ts +30 -0
- package/src/llmUtils.ts +54 -0
- package/src/modules/questionAnsweringModule.ts +44 -0
- package/src/modules/reviewModule.ts +31 -0
- package/src/modules/types.ts +23 -0
- package/src/prompt.ts +54 -0
- package/src/providers/file.ts +24 -0
- package/src/providers/ghPrDiffProvider.ts +20 -0
- package/src/providers/jiraIssueLegacyProvider.ts +103 -0
- package/src/providers/jiraIssueProvider.ts +133 -0
- package/src/providers/text.ts +14 -0
- package/src/providers/types.ts +24 -0
- package/src/systemUtils.ts +90 -0
- package/src/utils.ts +232 -0
- package/tsconfig.json +24 -0
- package/vitest.config.ts +13 -0
- package/.eslint.config.mjs +0 -72
- package/.github/dependabot.yml +0 -11
- package/.github/workflows/ci.yml +0 -33
- package/spec/.gsloth.config.js +0 -22
- package/spec/.gsloth.config.json +0 -25
- package/spec/askCommand.spec.js +0 -92
- package/spec/config.spec.js +0 -421
- package/spec/initCommand.spec.js +0 -55
- package/spec/predefinedConfigs.spec.js +0 -100
- package/spec/questionAnsweringModule.spec.js +0 -137
- package/spec/reviewCommand.spec.js +0 -222
- package/spec/reviewModule.spec.js +0 -28
- package/spec/support/jasmine.mjs +0 -14
- package/src/commands/askCommand.js +0 -27
- package/src/commands/initCommand.js +0 -17
- package/src/commands/reviewCommand.js +0 -154
- package/src/config.js +0 -177
- package/src/modules/questionAnsweringModule.js +0 -82
- package/src/modules/reviewModule.js +0 -70
- package/src/prompt.js +0 -34
- package/src/providers/file.js +0 -19
- package/src/providers/ghPrDiffProvider.js +0 -11
- package/src/providers/jiraIssueLegacyAccessTokenProvider.js +0 -84
- package/src/providers/text.js +0 -6
- package/src/systemUtils.js +0 -32
- package/src/utils.js +0 -173
- /package/{.gsloth.preamble.internal.md → .gsloth.backstory.md} +0 -0
@@ -0,0 +1,96 @@
|
|
1
|
+
import { display, displayError, displayWarning } from '#src/consoleUtils.js';
|
2
|
+
import { env } from '#src/systemUtils.js';
|
3
|
+
/**
|
4
|
+
* Gets Jira issue using Atlassian REST API v3 with Personal Access Token
|
5
|
+
*
|
6
|
+
* TODO we need to figure out how would this work with public jira.
|
7
|
+
*
|
8
|
+
* @param config Jira configuration
|
9
|
+
* @param issueId Jira issue ID
|
10
|
+
* @returns Jira issue content
|
11
|
+
*/
|
12
|
+
export async function get(config, issueId) {
|
13
|
+
if (!config) {
|
14
|
+
displayWarning('No Jira config provided');
|
15
|
+
return null;
|
16
|
+
}
|
17
|
+
if (!issueId) {
|
18
|
+
displayWarning('No issue ID provided');
|
19
|
+
return null;
|
20
|
+
}
|
21
|
+
// Get username from environment variable or config
|
22
|
+
const username = env.JIRA_USERNAME || config.username;
|
23
|
+
if (!username) {
|
24
|
+
throw new Error('Missing JIRA username. The username can be defined as JIRA_USERNAME environment variable or as "username" in config.');
|
25
|
+
}
|
26
|
+
// Get token from environment variable or config
|
27
|
+
const token = env.JIRA_API_PAT_TOKEN || config.token;
|
28
|
+
if (!token) {
|
29
|
+
throw new Error('Missing JIRA PAT token. The token can be defined as JIRA_API_PAT_TOKEN environment variable or as "token" in config.');
|
30
|
+
}
|
31
|
+
// Get cloud ID from environment variable or config
|
32
|
+
const cloudId = env.JIRA_CLOUD_ID || config.cloudId;
|
33
|
+
if (!cloudId) {
|
34
|
+
throw new Error('Missing JIRA Cloud ID. The Cloud ID can be defined as JIRA_CLOUD_ID environment variable or as "cloudId" in config.');
|
35
|
+
}
|
36
|
+
try {
|
37
|
+
const issue = await getJiraIssue({
|
38
|
+
...config,
|
39
|
+
username,
|
40
|
+
token,
|
41
|
+
cloudId,
|
42
|
+
}, issueId);
|
43
|
+
if (!issue) {
|
44
|
+
return null;
|
45
|
+
}
|
46
|
+
const summary = issue.fields.summary;
|
47
|
+
const description = issue.fields.description;
|
48
|
+
return `Jira Issue: ${issueId}\nSummary: ${summary}\n\nDescription:\n${description}`;
|
49
|
+
}
|
50
|
+
catch (error) {
|
51
|
+
displayError(`Failed to get Jira issue: ${error instanceof Error ? error.message : String(error)}`);
|
52
|
+
return null;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
/**
|
56
|
+
* Helper function to get Jira issue details using Atlassian REST API v3
|
57
|
+
* @param config Jira configuration
|
58
|
+
* @param jiraKey Jira issue ID
|
59
|
+
* @returns Jira issue response
|
60
|
+
*/
|
61
|
+
async function getJiraIssue(config, jiraKey) {
|
62
|
+
// Jira Cloud ID can be found by authenticated user at https://company.atlassian.net/_edge/tenant_info
|
63
|
+
// According to doc https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-issueidorkey-get permissions to read this resource:
|
64
|
+
// either Classic (RECOMMENDED) read:jira-work
|
65
|
+
// or Granular read:issue-meta:jira, read:issue-security-level:jira, read:issue.vote:jira, read:issue.changelog:jira, read:avatar:jira, read:issue:jira, read:status:jira, read:user:jira, read:field-configuration:jira
|
66
|
+
const apiUrl = `https://api.atlassian.com/ex/jira/${config.cloudId}/rest/api/3/issue/${jiraKey}`;
|
67
|
+
if (config.displayUrl) {
|
68
|
+
display(`Loading Jira issue ${config.displayUrl}${jiraKey}`);
|
69
|
+
}
|
70
|
+
display(`Retrieving jira from api ${apiUrl.replace(/^https?:\/\//, '')}`);
|
71
|
+
// Encode credentials for Basic Authentication header
|
72
|
+
const credentials = `${config.username}:${config.token}`;
|
73
|
+
const encodedCredentials = Buffer.from(credentials).toString('base64');
|
74
|
+
const authHeader = `Basic ${encodedCredentials}`;
|
75
|
+
// Define request headers
|
76
|
+
const headers = {
|
77
|
+
Authorization: authHeader,
|
78
|
+
Accept: 'application/json; charset=utf-8',
|
79
|
+
'Accept-Language': 'en-US,en;q=0.9', // Prevents errors in other languages
|
80
|
+
};
|
81
|
+
const response = await fetch(apiUrl, {
|
82
|
+
method: 'GET',
|
83
|
+
headers: headers,
|
84
|
+
});
|
85
|
+
if (!response?.ok) {
|
86
|
+
try {
|
87
|
+
const errorData = await response.json();
|
88
|
+
throw new Error(`Failed to fetch Jira issue: ${response.statusText} - ${JSON.stringify(errorData)}`);
|
89
|
+
}
|
90
|
+
catch (_e) {
|
91
|
+
throw new Error(`Failed to fetch Jira issue: ${response?.statusText}`);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
return response.json();
|
95
|
+
}
|
96
|
+
//# sourceMappingURL=jiraIssueProvider.js.map
|
@@ -0,0 +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;AAY1C;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,MAAkC,EAClC,OAA2B;IAE3B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,cAAc,CAAC,yBAAyB,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,cAAc,CAAC,sBAAsB,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,mDAAmD;IACnD,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,IAAI,MAAM,CAAC,QAAQ,CAAC;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@ -0,0 +1,8 @@
|
|
1
|
+
import type { ProviderConfig } from './types.js';
|
2
|
+
/**
|
3
|
+
* Returns the provided text as is
|
4
|
+
* @param _ config (unused in this provider)
|
5
|
+
* @param text Text to return
|
6
|
+
* @returns The provided text
|
7
|
+
*/
|
8
|
+
export declare function get(_: ProviderConfig | null, text: string | undefined): Promise<string | null>;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/providers/text.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,CAAwB,EACxB,IAAwB;IAExB,OAAO,IAAI,IAAI,IAAI,CAAC;AACtB,CAAC"}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export interface ProviderConfig {
|
2
|
+
username?: string;
|
3
|
+
token?: string;
|
4
|
+
baseUrl?: string;
|
5
|
+
[key: string]: unknown;
|
6
|
+
}
|
7
|
+
export interface JiraLegacyConfig extends ProviderConfig {
|
8
|
+
username: string;
|
9
|
+
baseUrl: string;
|
10
|
+
displayUrl?: string;
|
11
|
+
token: string;
|
12
|
+
}
|
13
|
+
export interface JiraConfig extends ProviderConfig {
|
14
|
+
cloudId: string;
|
15
|
+
username: string;
|
16
|
+
displayUrl?: string;
|
17
|
+
token: string;
|
18
|
+
}
|
19
|
+
export interface Provider {
|
20
|
+
get: (config: ProviderConfig | null, id: string | undefined) => Promise<string | null>;
|
21
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/providers/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { Command } from 'commander';
|
2
|
+
export declare const getCurrentDir: () => string;
|
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;
|
8
|
+
export declare const exit: (code?: number) => never;
|
9
|
+
export declare const stdin: NodeJS.ReadStream & {
|
10
|
+
fd: 0;
|
11
|
+
};
|
12
|
+
export declare const stdout: NodeJS.WriteStream & {
|
13
|
+
fd: 1;
|
14
|
+
};
|
15
|
+
export declare const argv: string[];
|
16
|
+
export declare const env: NodeJS.ProcessEnv;
|
17
|
+
/**
|
18
|
+
* Provide the path to the entry point of the application.
|
19
|
+
* This is used to set the install directory.
|
20
|
+
* This is called from index.js root entry point.
|
21
|
+
*/
|
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>;
|
28
|
+
export declare const log: (message: string) => void;
|
29
|
+
export declare const error: (message: string) => void;
|
30
|
+
export declare const warn: (message: string) => void;
|
31
|
+
export declare const info: (message: string) => void;
|
32
|
+
export declare const debug: (message: string) => void;
|
@@ -0,0 +1,70 @@
|
|
1
|
+
import { dirname, resolve } from 'node:path';
|
2
|
+
import { fileURLToPath } from 'url';
|
3
|
+
import { ProgressIndicator } from '#src/utils.js';
|
4
|
+
const innerState = {
|
5
|
+
installDir: undefined,
|
6
|
+
stringFromStdin: '',
|
7
|
+
};
|
8
|
+
// Process-related functions and objects
|
9
|
+
export const getCurrentDir = () => process.cwd();
|
10
|
+
export const getInstallDir = () => {
|
11
|
+
if (innerState.installDir) {
|
12
|
+
return innerState.installDir;
|
13
|
+
}
|
14
|
+
throw new Error('Install directory not set');
|
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
|
+
};
|
22
|
+
export const exit = (code) => process.exit(code || 0);
|
23
|
+
export const stdin = process.stdin;
|
24
|
+
export const stdout = process.stdout;
|
25
|
+
export const argv = process.argv;
|
26
|
+
export const env = process.env;
|
27
|
+
// noinspection JSUnusedGlobalSymbols
|
28
|
+
/**
|
29
|
+
* Provide the path to the entry point of the application.
|
30
|
+
* This is used to set the install directory.
|
31
|
+
* This is called from index.js root entry point.
|
32
|
+
*/
|
33
|
+
export const setEntryPoint = (indexJs) => {
|
34
|
+
const filePath = fileURLToPath(indexJs);
|
35
|
+
const dirPath = dirname(filePath);
|
36
|
+
innerState.installDir = resolve(dirPath);
|
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
|
+
}
|
64
|
+
// Console-related functions
|
65
|
+
export const log = (message) => console.log(message);
|
66
|
+
export const error = (message) => console.error(message);
|
67
|
+
export const warn = (message) => console.warn(message);
|
68
|
+
export const info = (message) => console.info(message);
|
69
|
+
export const debug = (message) => console.debug(message);
|
70
|
+
//# sourceMappingURL=systemUtils.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"systemUtils.js","sourceRoot":"","sources":["../src/systemUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,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G,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
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
import { SlothConfig } from '#src/config.js';
|
2
|
+
export declare function toFileSafeString(string: string): string;
|
3
|
+
export declare function fileSafeLocalDate(): string;
|
4
|
+
export declare function readFileFromCurrentDir(fileName: string): string;
|
5
|
+
export declare function readFileFromCurrentOrInstallDir(filePath: string, silentCurrent?: boolean): string;
|
6
|
+
export declare function writeFileIfNotExistsWithMessages(filePath: string, content: string): void;
|
7
|
+
export declare function readFileSyncWithMessages(filePath: string, errorMessageIn?: string, noFileMessage?: string): string;
|
8
|
+
export declare function spawnCommand(command: string, args: string[], progressMessage: string, successMessage: string): Promise<string>;
|
9
|
+
export declare function getSlothVersion(): string;
|
10
|
+
export declare class ProgressIndicator {
|
11
|
+
private interval;
|
12
|
+
constructor(initialMessage: string, manual?: boolean);
|
13
|
+
private indicateInner;
|
14
|
+
indicate(): void;
|
15
|
+
stop(): void;
|
16
|
+
}
|
17
|
+
interface LLMOutput {
|
18
|
+
messages: Array<{
|
19
|
+
content: string;
|
20
|
+
}>;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Extracts the content of the last message from an LLM response
|
24
|
+
* @param output - The output from the LLM containing messages
|
25
|
+
* @returns The content of the last message
|
26
|
+
*/
|
27
|
+
export declare function extractLastMessageContent(output: LLMOutput): string;
|
28
|
+
/**
|
29
|
+
* Dynamically imports a module from a file path from the outside of the installation dir
|
30
|
+
* @param filePath - The path to the file to import
|
31
|
+
* @returns A promise that resolves to the imported module
|
32
|
+
*/
|
33
|
+
export declare function importExternalFile(filePath: string): Promise<{
|
34
|
+
configure: (module: string) => Promise<Partial<SlothConfig>>;
|
35
|
+
}>;
|
36
|
+
/**
|
37
|
+
* Alias for importExternalFile for backward compatibility with tests
|
38
|
+
* @param filePath - The path to the file to import
|
39
|
+
* @returns A promise that resolves to the imported module
|
40
|
+
*/
|
41
|
+
export declare const importFromFilePath: typeof importExternalFile;
|
42
|
+
/**
|
43
|
+
* Reads multiple files from the current directory and returns their contents
|
44
|
+
* @param fileNames - Array of file names to read
|
45
|
+
* @returns Combined content of all files with proper formatting
|
46
|
+
*/
|
47
|
+
export declare function readMultipleFilesFromCurrentDir(fileNames: string | string[]): string;
|
48
|
+
export declare function execAsync(command: string): Promise<string>;
|
49
|
+
export {};
|
package/dist/utils.js
ADDED
@@ -0,0 +1,192 @@
|
|
1
|
+
import { display, displayError, displaySuccess, displayWarning } from '#src/consoleUtils.js';
|
2
|
+
import { existsSync, readFileSync, writeFileSync } from 'node:fs';
|
3
|
+
import { resolve } from 'node:path';
|
4
|
+
import { spawn } from 'node:child_process';
|
5
|
+
import { getCurrentDir, getInstallDir, stdout } from '#src/systemUtils.js';
|
6
|
+
import url from 'node:url';
|
7
|
+
export function toFileSafeString(string) {
|
8
|
+
return string.replace(/[^A-Za-z0-9]/g, '-');
|
9
|
+
}
|
10
|
+
export function fileSafeLocalDate() {
|
11
|
+
const date = new Date();
|
12
|
+
const offsetMs = date.getTimezoneOffset() * 60 * 1000;
|
13
|
+
const msLocal = date.getTime() - offsetMs;
|
14
|
+
const dateLocal = new Date(msLocal);
|
15
|
+
const iso = dateLocal.toISOString();
|
16
|
+
const isoLocal = iso.slice(0, 19);
|
17
|
+
return toFileSafeString(isoLocal);
|
18
|
+
}
|
19
|
+
export function readFileFromCurrentDir(fileName) {
|
20
|
+
const currentDir = getCurrentDir();
|
21
|
+
const filePath = resolve(currentDir, fileName);
|
22
|
+
display(`Reading file ${filePath}...`);
|
23
|
+
return readFileSyncWithMessages(filePath);
|
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
|
+
}
|
49
|
+
export function writeFileIfNotExistsWithMessages(filePath, content) {
|
50
|
+
display(`checking ${filePath} existence`);
|
51
|
+
if (!existsSync(filePath)) {
|
52
|
+
writeFileSync(filePath, content);
|
53
|
+
displaySuccess(`Created ${filePath}`);
|
54
|
+
}
|
55
|
+
else {
|
56
|
+
displayWarning(`${filePath} already exists`);
|
57
|
+
}
|
58
|
+
}
|
59
|
+
export function readFileSyncWithMessages(filePath, errorMessageIn, noFileMessage) {
|
60
|
+
const errorMessage = errorMessageIn ?? 'Error reading file at: ';
|
61
|
+
try {
|
62
|
+
return readFileSync(filePath, { encoding: 'utf8' });
|
63
|
+
}
|
64
|
+
catch (error) {
|
65
|
+
displayError(errorMessage + filePath);
|
66
|
+
if (error.code === 'ENOENT') {
|
67
|
+
displayWarning(noFileMessage ?? 'Please ensure the file exists.');
|
68
|
+
}
|
69
|
+
else {
|
70
|
+
displayError(error.message);
|
71
|
+
}
|
72
|
+
throw error;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
export async function spawnCommand(command, args, progressMessage, successMessage) {
|
76
|
+
return new Promise((resolve, reject) => {
|
77
|
+
const progressIndicator = new ProgressIndicator(progressMessage, true);
|
78
|
+
const out = { stdout: '', stderr: '' };
|
79
|
+
const spawned = spawn(command, args);
|
80
|
+
spawned.stdout.on('data', async (stdoutChunk) => {
|
81
|
+
progressIndicator.indicate();
|
82
|
+
out.stdout += stdoutChunk.toString();
|
83
|
+
});
|
84
|
+
spawned.stderr.on('data', (err) => {
|
85
|
+
progressIndicator.indicate();
|
86
|
+
out.stderr += err.toString();
|
87
|
+
});
|
88
|
+
spawned.on('error', (err) => {
|
89
|
+
reject(err.toString());
|
90
|
+
});
|
91
|
+
spawned.on('close', (code) => {
|
92
|
+
if (code === 0) {
|
93
|
+
display(successMessage);
|
94
|
+
resolve(out.stdout);
|
95
|
+
}
|
96
|
+
else {
|
97
|
+
displayError(`Failed to spawn command with code ${code}`);
|
98
|
+
reject(out.stdout + ' ' + out.stderr);
|
99
|
+
}
|
100
|
+
});
|
101
|
+
});
|
102
|
+
}
|
103
|
+
export function getSlothVersion() {
|
104
|
+
// TODO figure out if this can be injected with TS
|
105
|
+
const installDir = getInstallDir();
|
106
|
+
const jsonPath = resolve(installDir, 'package.json');
|
107
|
+
const projectJson = readFileSync(jsonPath, { encoding: 'utf8' });
|
108
|
+
return JSON.parse(projectJson).version;
|
109
|
+
}
|
110
|
+
export class ProgressIndicator {
|
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('.');
|
120
|
+
}
|
121
|
+
indicate() {
|
122
|
+
if (this.interval) {
|
123
|
+
throw new Error('ProgressIndicator.indicate only to be called in manual mode');
|
124
|
+
}
|
125
|
+
this.indicateInner();
|
126
|
+
}
|
127
|
+
stop() {
|
128
|
+
if (this.interval) {
|
129
|
+
clearInterval(this.interval);
|
130
|
+
}
|
131
|
+
stdout.write('\n');
|
132
|
+
}
|
133
|
+
}
|
134
|
+
/**
|
135
|
+
* Extracts the content of the last message from an LLM response
|
136
|
+
* @param output - The output from the LLM containing messages
|
137
|
+
* @returns The content of the last message
|
138
|
+
*/
|
139
|
+
export function extractLastMessageContent(output) {
|
140
|
+
if (!output || !output.messages || !output.messages.length) {
|
141
|
+
return '';
|
142
|
+
}
|
143
|
+
return output.messages[output.messages.length - 1].content;
|
144
|
+
}
|
145
|
+
/**
|
146
|
+
* Dynamically imports a module from a file path from the outside of the installation dir
|
147
|
+
* @param filePath - The path to the file to import
|
148
|
+
* @returns A promise that resolves to the imported module
|
149
|
+
*/
|
150
|
+
export function importExternalFile(filePath) {
|
151
|
+
const configFileUrl = url.pathToFileURL(filePath).toString();
|
152
|
+
return import(configFileUrl);
|
153
|
+
}
|
154
|
+
/**
|
155
|
+
* Alias for importExternalFile for backward compatibility with tests
|
156
|
+
* @param filePath - The path to the file to import
|
157
|
+
* @returns A promise that resolves to the imported module
|
158
|
+
*/
|
159
|
+
export const importFromFilePath = importExternalFile;
|
160
|
+
/**
|
161
|
+
* Reads multiple files from the current directory and returns their contents
|
162
|
+
* @param fileNames - Array of file names to read
|
163
|
+
* @returns Combined content of all files with proper formatting
|
164
|
+
*/
|
165
|
+
export function readMultipleFilesFromCurrentDir(fileNames) {
|
166
|
+
if (!Array.isArray(fileNames)) {
|
167
|
+
return readFileFromCurrentDir(fileNames);
|
168
|
+
}
|
169
|
+
return fileNames
|
170
|
+
.map((fileName) => {
|
171
|
+
const content = readFileFromCurrentDir(fileName);
|
172
|
+
return `${fileName}:\n\`\`\`\n${content}\n\`\`\``;
|
173
|
+
})
|
174
|
+
.join('\n\n');
|
175
|
+
}
|
176
|
+
export async function execAsync(command) {
|
177
|
+
const { exec } = await import('node:child_process');
|
178
|
+
return new Promise((resolve, reject) => {
|
179
|
+
exec(command, (error, stdout, stderr) => {
|
180
|
+
if (error) {
|
181
|
+
reject(error);
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
if (stderr) {
|
185
|
+
reject(new Error(stderr));
|
186
|
+
return;
|
187
|
+
}
|
188
|
+
resolve(stdout.trim());
|
189
|
+
});
|
190
|
+
});
|
191
|
+
}
|
192
|
+
//# sourceMappingURL=utils.js.map
|
@@ -0,0 +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;AAElE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;IACxB,MAAM,QAAQ,GAAG,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACtD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,QAAQ,CAAC;IAC1C,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,MAAM,GAAG,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,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