gaunt-sloth-assistant 0.9.12 → 0.9.13
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.guidelines.md +4 -5
- package/dist/consoleUtils.d.ts +43 -0
- package/dist/consoleUtils.js +162 -16
- package/dist/consoleUtils.js.map +1 -1
- package/dist/core/GthAgentRunner.js +1 -1
- package/dist/core/GthAgentRunner.js.map +1 -1
- package/dist/core/GthLangChainAgent.js +1 -1
- package/dist/core/GthLangChainAgent.js.map +1 -1
- package/dist/debugUtils.d.ts +26 -10
- package/dist/debugUtils.js +31 -78
- package/dist/debugUtils.js.map +1 -1
- package/dist/fileUtils.d.ts +70 -0
- package/dist/fileUtils.js +191 -0
- package/dist/fileUtils.js.map +1 -0
- package/dist/globalConfigUtils.d.ts +5 -0
- package/dist/globalConfigUtils.js +6 -0
- package/dist/globalConfigUtils.js.map +1 -1
- package/dist/modules/interactiveSessionModule.js +11 -0
- package/dist/modules/interactiveSessionModule.js.map +1 -1
- package/dist/pathUtils.d.ts +63 -0
- package/dist/pathUtils.js +143 -10
- package/dist/pathUtils.js.map +1 -1
- package/dist/presets/anthropic.js +1 -1
- package/dist/presets/anthropic.js.map +1 -1
- package/dist/systemUtils.d.ts +3 -17
- package/dist/systemUtils.js +11 -71
- package/dist/systemUtils.js.map +1 -1
- package/dist/utils.d.ts +2 -26
- package/dist/utils.js +9 -97
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { GthConfig } from '#src/config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reads a file from the current project directory
|
|
4
|
+
* @param fileName - The name/path of the file relative to the project directory
|
|
5
|
+
* @returns The contents of the file as a string
|
|
6
|
+
*/
|
|
7
|
+
export declare function readFileFromProjectDir(fileName: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Reads a file from the installation directory
|
|
10
|
+
* @param filePath - The path relative to the installation directory
|
|
11
|
+
* @returns The contents of the file as a string
|
|
12
|
+
* @throws Error if the file cannot be read
|
|
13
|
+
*/
|
|
14
|
+
export declare function readFileFromInstallDir(filePath: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Writes a file only if it doesn't already exist, with informative messages
|
|
17
|
+
* @param filePath - The absolute path where to write the file
|
|
18
|
+
* @param content - The content to write to the file
|
|
19
|
+
*/
|
|
20
|
+
export declare function writeFileIfNotExistsWithMessages(filePath: string, content: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Appends content to a file, creating parent directories if necessary
|
|
23
|
+
* @param filePath - The absolute path of the file to append to
|
|
24
|
+
* @param content - The content to append to the file
|
|
25
|
+
*/
|
|
26
|
+
export declare function appendToFile(filePath: string, content: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* Reads a file synchronously with error handling and informative messages
|
|
29
|
+
* @param filePath - The absolute path of the file to read
|
|
30
|
+
* @param errorMessageIn - Custom error message prefix (optional)
|
|
31
|
+
* @param noFileMessage - Custom message when file doesn't exist (optional)
|
|
32
|
+
* @returns The contents of the file as a string
|
|
33
|
+
* @throws Error if the file cannot be read
|
|
34
|
+
*/
|
|
35
|
+
export declare function readFileSyncWithMessages(filePath: string, errorMessageIn?: string, noFileMessage?: string): string;
|
|
36
|
+
/**
|
|
37
|
+
* Reads multiple files from the current directory and returns their contents
|
|
38
|
+
* Each file is wrapped in a content block with a unique identifier
|
|
39
|
+
* @param fileNames - A single file name or array of file names to read
|
|
40
|
+
* @returns Combined content of all files with proper formatting
|
|
41
|
+
*/
|
|
42
|
+
export declare function readMultipleFilesFromProjectDir(fileNames: string | string[]): string;
|
|
43
|
+
/**
|
|
44
|
+
* Dynamically imports a module from a file path outside of the installation directory
|
|
45
|
+
* @param filePath - The absolute path to the file to import
|
|
46
|
+
* @returns A promise that resolves to the imported module with a configure function
|
|
47
|
+
*/
|
|
48
|
+
export declare function importExternalFile(filePath: string): Promise<{
|
|
49
|
+
configure: () => Promise<Partial<GthConfig>>;
|
|
50
|
+
}>;
|
|
51
|
+
/**
|
|
52
|
+
* Alias for importExternalFile for backward compatibility with tests
|
|
53
|
+
* @param filePath - The path to the file to import
|
|
54
|
+
* @returns A promise that resolves to the imported module
|
|
55
|
+
*/
|
|
56
|
+
export declare const importFromFilePath: typeof importExternalFile;
|
|
57
|
+
/**
|
|
58
|
+
* Initializes a log stream for writing log messages to a file
|
|
59
|
+
* @param logFileName - The path to the log file
|
|
60
|
+
*/
|
|
61
|
+
export declare const initLogStream: (logFileName: string) => void;
|
|
62
|
+
/**
|
|
63
|
+
* Writes a message to the current log stream if available
|
|
64
|
+
* @param message - The message to write to the log stream
|
|
65
|
+
*/
|
|
66
|
+
export declare const writeToLogStream: (message: string) => void;
|
|
67
|
+
/**
|
|
68
|
+
* Closes the current log stream if open
|
|
69
|
+
*/
|
|
70
|
+
export declare const closeLogStream: () => void;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { displayError, displayInfo, displaySuccess, displayWarning } from '#src/consoleUtils.js';
|
|
2
|
+
import { wrapContent } from '#src/prompt.js';
|
|
3
|
+
import { getInstallDir, getProjectDir } from '#src/systemUtils.js';
|
|
4
|
+
import { appendFileSync, createWriteStream, existsSync, mkdirSync, readFileSync, writeFileSync, } from 'node:fs';
|
|
5
|
+
import { dirname, resolve } from 'node:path';
|
|
6
|
+
import url from 'node:url';
|
|
7
|
+
const logStreamState = {
|
|
8
|
+
logWriteStream: undefined,
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Reads a file from the current project directory
|
|
12
|
+
* @param fileName - The name/path of the file relative to the project directory
|
|
13
|
+
* @returns The contents of the file as a string
|
|
14
|
+
*/
|
|
15
|
+
export function readFileFromProjectDir(fileName) {
|
|
16
|
+
const currentDir = getProjectDir();
|
|
17
|
+
const filePath = resolve(currentDir, fileName);
|
|
18
|
+
displayInfo(`Reading file ${filePath}...`);
|
|
19
|
+
return readFileSyncWithMessages(filePath);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reads a file from the installation directory
|
|
23
|
+
* @param filePath - The path relative to the installation directory
|
|
24
|
+
* @returns The contents of the file as a string
|
|
25
|
+
* @throws Error if the file cannot be read
|
|
26
|
+
*/
|
|
27
|
+
export function readFileFromInstallDir(filePath) {
|
|
28
|
+
const installDir = getInstallDir();
|
|
29
|
+
const installFilePath = resolve(installDir, filePath);
|
|
30
|
+
try {
|
|
31
|
+
return readFileSync(installFilePath, { encoding: 'utf8' });
|
|
32
|
+
}
|
|
33
|
+
catch (readFromInstallDirError) {
|
|
34
|
+
displayError(`The ${installFilePath} not found or can\'t be read.`);
|
|
35
|
+
throw readFromInstallDirError;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Writes a file only if it doesn't already exist, with informative messages
|
|
40
|
+
* @param filePath - The absolute path where to write the file
|
|
41
|
+
* @param content - The content to write to the file
|
|
42
|
+
*/
|
|
43
|
+
export function writeFileIfNotExistsWithMessages(filePath, content) {
|
|
44
|
+
displayInfo(`checking ${filePath} existence`);
|
|
45
|
+
if (!existsSync(filePath)) {
|
|
46
|
+
// Create parent directories if they don't exist
|
|
47
|
+
const parentDir = dirname(filePath);
|
|
48
|
+
if (!existsSync(parentDir)) {
|
|
49
|
+
mkdirSync(parentDir, { recursive: true });
|
|
50
|
+
}
|
|
51
|
+
writeFileSync(filePath, content);
|
|
52
|
+
displaySuccess(`Created ${filePath}`);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
displayWarning(`${filePath} already exists`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Appends content to a file, creating parent directories if necessary
|
|
60
|
+
* @param filePath - The absolute path of the file to append to
|
|
61
|
+
* @param content - The content to append to the file
|
|
62
|
+
*/
|
|
63
|
+
export function appendToFile(filePath, content) {
|
|
64
|
+
try {
|
|
65
|
+
const parentDir = dirname(filePath);
|
|
66
|
+
if (!existsSync(parentDir)) {
|
|
67
|
+
mkdirSync(parentDir, { recursive: true });
|
|
68
|
+
}
|
|
69
|
+
appendFileSync(filePath, content);
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
displayError(`Failed to append to file ${filePath}: ${e.message}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Reads a file synchronously with error handling and informative messages
|
|
77
|
+
* @param filePath - The absolute path of the file to read
|
|
78
|
+
* @param errorMessageIn - Custom error message prefix (optional)
|
|
79
|
+
* @param noFileMessage - Custom message when file doesn't exist (optional)
|
|
80
|
+
* @returns The contents of the file as a string
|
|
81
|
+
* @throws Error if the file cannot be read
|
|
82
|
+
*/
|
|
83
|
+
export function readFileSyncWithMessages(filePath, errorMessageIn, noFileMessage) {
|
|
84
|
+
const errorMessage = errorMessageIn ?? 'Error reading file at: ';
|
|
85
|
+
try {
|
|
86
|
+
return readFileSync(filePath, { encoding: 'utf8' });
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
displayError(errorMessage + filePath);
|
|
90
|
+
if (error.code === 'ENOENT') {
|
|
91
|
+
displayWarning(noFileMessage ?? 'Please ensure the file exists.');
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
displayError(error.message);
|
|
95
|
+
}
|
|
96
|
+
throw error;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Reads multiple files from the current directory and returns their contents
|
|
101
|
+
* Each file is wrapped in a content block with a unique identifier
|
|
102
|
+
* @param fileNames - A single file name or array of file names to read
|
|
103
|
+
* @returns Combined content of all files with proper formatting
|
|
104
|
+
*/
|
|
105
|
+
export function readMultipleFilesFromProjectDir(fileNames) {
|
|
106
|
+
if (!Array.isArray(fileNames)) {
|
|
107
|
+
return wrapContent(readFileFromProjectDir(fileNames), 'file', `file ${fileNames}`, true);
|
|
108
|
+
}
|
|
109
|
+
return fileNames
|
|
110
|
+
.map((fileName) => {
|
|
111
|
+
const content = readFileFromProjectDir(fileName);
|
|
112
|
+
return `${wrapContent(content, 'file', `file ${fileName}`, true)}`;
|
|
113
|
+
})
|
|
114
|
+
.join('\n\n');
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Dynamically imports a module from a file path outside of the installation directory
|
|
118
|
+
* @param filePath - The absolute path to the file to import
|
|
119
|
+
* @returns A promise that resolves to the imported module with a configure function
|
|
120
|
+
*/
|
|
121
|
+
export function importExternalFile(filePath) {
|
|
122
|
+
const configFileUrl = url.pathToFileURL(filePath).toString();
|
|
123
|
+
return import(configFileUrl);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Alias for importExternalFile for backward compatibility with tests
|
|
127
|
+
* @param filePath - The path to the file to import
|
|
128
|
+
* @returns A promise that resolves to the imported module
|
|
129
|
+
*/
|
|
130
|
+
export const importFromFilePath = importExternalFile;
|
|
131
|
+
/**
|
|
132
|
+
* Initializes a log stream for writing log messages to a file
|
|
133
|
+
* @param logFileName - The path to the log file
|
|
134
|
+
*/
|
|
135
|
+
export const initLogStream = (logFileName) => {
|
|
136
|
+
try {
|
|
137
|
+
// Close existing stream if present
|
|
138
|
+
if (logStreamState.logWriteStream) {
|
|
139
|
+
logStreamState.logWriteStream.end();
|
|
140
|
+
}
|
|
141
|
+
// Create new write stream with append mode
|
|
142
|
+
logStreamState.logWriteStream = createWriteStream(logFileName, {
|
|
143
|
+
flags: 'a',
|
|
144
|
+
autoClose: true,
|
|
145
|
+
});
|
|
146
|
+
// Handle stream errors
|
|
147
|
+
logStreamState.logWriteStream.on('error', (err) => {
|
|
148
|
+
displayWarning(`Log stream error: ${err.message}`);
|
|
149
|
+
logStreamState.logWriteStream = undefined;
|
|
150
|
+
});
|
|
151
|
+
// Handle stream close
|
|
152
|
+
logStreamState.logWriteStream.on('close', () => {
|
|
153
|
+
logStreamState.logWriteStream = undefined;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
catch (err) {
|
|
157
|
+
displayWarning(`Failed to create log stream: ${err instanceof Error ? err.message : String(err)}`);
|
|
158
|
+
logStreamState.logWriteStream = undefined;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
/**
|
|
162
|
+
* Writes a message to the current log stream if available
|
|
163
|
+
* @param message - The message to write to the log stream
|
|
164
|
+
*/
|
|
165
|
+
export const writeToLogStream = (message) => {
|
|
166
|
+
if (logStreamState.logWriteStream && !logStreamState.logWriteStream.destroyed) {
|
|
167
|
+
logStreamState.logWriteStream.write(message);
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Closes the current log stream if open
|
|
172
|
+
*/
|
|
173
|
+
export const closeLogStream = () => {
|
|
174
|
+
if (logStreamState.logWriteStream && !logStreamState.logWriteStream.destroyed) {
|
|
175
|
+
logStreamState.logWriteStream.end();
|
|
176
|
+
logStreamState.logWriteStream = undefined;
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
// Ensure log stream is closed on process exit
|
|
180
|
+
process.on('exit', () => {
|
|
181
|
+
closeLogStream();
|
|
182
|
+
});
|
|
183
|
+
process.on('SIGINT', () => {
|
|
184
|
+
closeLogStream();
|
|
185
|
+
process.exit(0);
|
|
186
|
+
});
|
|
187
|
+
process.on('SIGTERM', () => {
|
|
188
|
+
closeLogStream();
|
|
189
|
+
process.exit(0);
|
|
190
|
+
});
|
|
191
|
+
//# sourceMappingURL=fileUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../src/fileUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,YAAY,E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AAG,EAAE;IACxB,cAAc,EAAE,CAAC;IACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;IACzB,cAAc,EAAE,CAAC;IACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated This file is deprecated as of Release 2. All functions have been consolidated into pathUtils.ts.
|
|
3
|
+
* This file will be removed in a future release. Please use pathUtils.ts instead.
|
|
4
|
+
*/
|
|
1
5
|
/**
|
|
2
6
|
* Gets the global .gsloth directory path in the user's home directory
|
|
3
7
|
* @returns The resolved path to the global .gsloth directory
|
|
@@ -26,3 +30,4 @@ export declare function ensureGlobalAuthDir(): string;
|
|
|
26
30
|
* @returns The resolved path where the OAuth data should be stored
|
|
27
31
|
*/
|
|
28
32
|
export declare function getOAuthStoragePath(serverUrl: string): string;
|
|
33
|
+
export { getGlobalGslothDir as getGlobalGslothDir_new, ensureGlobalGslothDir as ensureGlobalGslothDir_new, getGlobalAuthDir as getGlobalAuthDir_new, ensureGlobalAuthDir as ensureGlobalAuthDir_new, getOAuthStoragePath as getOAuthStoragePath_new, } from '#src/pathUtils.js';
|
|
@@ -2,6 +2,10 @@ import { existsSync, mkdirSync } from 'node:fs';
|
|
|
2
2
|
import { resolve } from 'node:path';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { GSLOTH_DIR, GSLOTH_AUTH } from '#src/constants.js';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated This file is deprecated as of Release 2. All functions have been consolidated into pathUtils.ts.
|
|
7
|
+
* This file will be removed in a future release. Please use pathUtils.ts instead.
|
|
8
|
+
*/
|
|
5
9
|
/**
|
|
6
10
|
* Gets the global .gsloth directory path in the user's home directory
|
|
7
11
|
* @returns The resolved path to the global .gsloth directory
|
|
@@ -58,4 +62,6 @@ export function getOAuthStoragePath(serverUrl) {
|
|
|
58
62
|
.toLowerCase();
|
|
59
63
|
return resolve(authDir, `${safeFilename}.json`);
|
|
60
64
|
}
|
|
65
|
+
// Re-export from pathUtils.ts for backward compatibility (Release 2)
|
|
66
|
+
export { getGlobalGslothDir as getGlobalGslothDir_new, ensureGlobalGslothDir as ensureGlobalGslothDir_new, getGlobalAuthDir as getGlobalAuthDir_new, ensureGlobalAuthDir as ensureGlobalAuthDir_new, getOAuthStoragePath as getOAuthStoragePath_new, } from '#src/pathUtils.js';
|
|
61
67
|
//# sourceMappingURL=globalConfigUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globalConfigUtils.js","sourceRoot":"","sources":["../src/globalConfigUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE5D;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,OAAO,CAAC,OAAO,EAAE,EAAE,UAAU,CAAC,CAAC;AACxC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB;IACnC,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;IAEvC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,SAAS,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,gBAAgB;IAC9B,MAAM,SAAS,GAAG,kBAAkB,EAAE,CAAC;IACvC,OAAO,OAAO,CAAC,SAAS,EAAE,WA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teractiveSession(sessionConfig, commandLineConfigO
|
|
|
41
41
|
if (systemPrompt) {
|
|
42
42
|
systemPromptParts.push(systemPrompt);
|
|
43
43
|
}
|
|
44
|
+
// TODO add cache control for Anthropic
|
|
45
|
+
// messages.push(
|
|
46
|
+
// new SystemMessage({
|
|
47
|
+
// content: [
|
|
48
|
+
// {
|
|
49
|
+
// text: systemPromptParts.join('\n'),
|
|
50
|
+
// type: 'text',
|
|
51
|
+
// // cache_control: { type: 'ephemeral' },
|
|
52
|
+
// },
|
|
53
|
+
// ],
|
|
54
|
+
// })
|
|
44
55
|
messages.push(new SystemMessage(systemPromptParts.join('\n')));
|
|
45
56
|
}
|
|
46
57
|
messages.push(new HumanMessage(userInput));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactiveSessionModule.js","sourceRoot":"","sources":["../../src/modules/interactiveSessionModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EACL,eAAe,EACf,KAAK,EACL,IAAI,EACJ,UAAU,EACV,KAAK,IAAI,KAAK,EACd,MAAM,IAAI,MAAM,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAoB,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAUnD,MAAM,CA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AC,YAAY,CAAC,CAAC;YACpC,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,UAAU;YAAE,MAAM,WAAW,EAAE,CAAC;QACrC,IAAI,UAAU,EAAE,CAAC;YACf,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,EAAE,CAAC;YACT,CAAC,EAAE,GAAG,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,kBAAkB,EAAE,CAAC;QACrB,KAAK,CAAC,YAAY,aAAa,CAAC,IAAI,aAAa,GAAG,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"interactiveSessionModule.js","sourceRoot":"","sources":["../../src/modules/interactiveSessionModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EACL,qBAAqB,EACrB,OAAO,EACP,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,EACL,eAAe,EACf,KAAK,EACL,IAAI,EACJ,UAAU,EACV,KAAK,IAAI,KAAK,EACd,MAAM,IAAI,MAAM,GACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAoB,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,WAAW,EAAE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BACzC,CAAC;YACH,CAAC;YACD,EAAE,CAAC,KAAK,EAAE,CAAC;QACb,CAAC,CAAC;QAEF,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;QAChC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;YACpC,WAAW,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,CAAC,UAAU;YAAE,MAAM,WAAW,EAAE,CAAC;QACrC,IAAI,UAAU,EAAE,CAAC;YACf,UAAU,CAAC,GAAG,EAAE;gBACd,IAAI,EAAE,CAAC;YACT,CAAC,EAAE,GAAG,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,MAAM,CAAC,OAAO,EAAE,CAAC;QACvB,kBAAkB,EAAE,CAAC;QACrB,KAAK,CAAC,YAAY,aAAa,CAAC,IAAI,aAAa,GAAG,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,CAAC,CAAC,CAAC;IACV,CAAC;AACH,CAAC"}
|
package/dist/pathUtils.d.ts
CHANGED
|
@@ -42,3 +42,66 @@ export declare function resolveOutputPath(writeOutputToFile: string): string;
|
|
|
42
42
|
* - If writeOutputToFile is true, generates a standard filename from source and resolves it under .gsloth/ (when present) or project root.
|
|
43
43
|
*/
|
|
44
44
|
export declare function getCommandOutputFilePath(config: GthConfig, source: string): string | null;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the global .gsloth directory path in the user's home directory
|
|
47
|
+
* @returns The resolved path to the global .gsloth directory
|
|
48
|
+
*/
|
|
49
|
+
export declare function getGlobalGslothDir(): string;
|
|
50
|
+
/**
|
|
51
|
+
* Ensures the global .gsloth directory exists in the user's home directory
|
|
52
|
+
* Creates it if it doesn't exist
|
|
53
|
+
* @returns The resolved path to the global .gsloth directory
|
|
54
|
+
*/
|
|
55
|
+
export declare function ensureGlobalGslothDir(): string;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the global auth directory path
|
|
58
|
+
* @returns The resolved path to the global auth directory
|
|
59
|
+
*/
|
|
60
|
+
export declare function getGlobalAuthDir(): string;
|
|
61
|
+
/**
|
|
62
|
+
* Ensures the global auth directory exists
|
|
63
|
+
* Creates it if it doesn't exist
|
|
64
|
+
* @returns The resolved path to the global auth directory
|
|
65
|
+
*/
|
|
66
|
+
export declare function ensureGlobalAuthDir(): string;
|
|
67
|
+
/**
|
|
68
|
+
* Gets the path for a specific OAuth provider's storage file
|
|
69
|
+
* @param serverUrl The server URL or identifier for the OAuth provider
|
|
70
|
+
* @returns The resolved path where the OAuth data should be stored
|
|
71
|
+
*/
|
|
72
|
+
export declare function getOAuthStoragePath(serverUrl: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Gets the current project directory
|
|
75
|
+
* @returns The current working directory
|
|
76
|
+
*/
|
|
77
|
+
export declare const getProjectDir: () => string;
|
|
78
|
+
/**
|
|
79
|
+
* Gets the installation directory
|
|
80
|
+
* @returns The installation directory path
|
|
81
|
+
* @throws Error if install directory not set
|
|
82
|
+
*/
|
|
83
|
+
export declare const getInstallDir: () => string;
|
|
84
|
+
/**
|
|
85
|
+
* Provide the path to the entry point of the application.
|
|
86
|
+
* This is used to set the install directory.
|
|
87
|
+
* This is called from cli.js root entry point.
|
|
88
|
+
* @param indexJs The path to the entry point file
|
|
89
|
+
*/
|
|
90
|
+
export declare const setEntryPoint: (indexJs: string) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Converts a string to a file-safe format by replacing non-alphanumeric characters with dashes
|
|
93
|
+
* @param string The string to convert
|
|
94
|
+
* @returns A file-safe string
|
|
95
|
+
*/
|
|
96
|
+
export declare function toFileSafeString(string: string): string;
|
|
97
|
+
/**
|
|
98
|
+
* Returns a formatted date string in the format YYYY-MM-DD_HH-MM-SS using local time
|
|
99
|
+
* @returns A formatted date string
|
|
100
|
+
*/
|
|
101
|
+
export declare function fileSafeLocalDate(): string;
|
|
102
|
+
/**
|
|
103
|
+
* Generates a standardized filename with the format: gth_YYYY-MM-DD_HH-MM-SS_COMMAND.md
|
|
104
|
+
* @param command - The command that created the file (ASK, REVIEW, PR, etc.)
|
|
105
|
+
* @returns A standardized filename string
|
|
106
|
+
*/
|
|
107
|
+
export declare function generateStandardFileName(command: string): string;
|
package/dist/pathUtils.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs';
|
|
1
|
+
import { existsSync, mkdirSync } from 'node:fs';
|
|
2
2
|
import { resolve, dirname } from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { fileURLToPath } from 'url';
|
|
5
|
+
import { getProjectDir as getProjectDirFromSystemUtils } from '#src/systemUtils.js';
|
|
6
|
+
import { GSLOTH_DIR, GSLOTH_SETTINGS_DIR, GSLOTH_AUTH } from '#src/constants.js';
|
|
7
7
|
/**
|
|
8
8
|
* Checks if .gsloth directory exists in the project root
|
|
9
9
|
* @returns Boolean indicating whether .gsloth directory exists
|
|
10
10
|
*/
|
|
11
11
|
export function gslothDirExists() {
|
|
12
|
-
const currentDir =
|
|
12
|
+
const currentDir = getProjectDirFromSystemUtils();
|
|
13
13
|
const gslothDirPath = resolve(currentDir, GSLOTH_DIR);
|
|
14
14
|
return existsSync(gslothDirPath);
|
|
15
15
|
}
|
|
@@ -19,7 +19,7 @@ export function gslothDirExists() {
|
|
|
19
19
|
* @returns The resolved path where the file should be written
|
|
20
20
|
*/
|
|
21
21
|
export function getGslothFilePath(filename) {
|
|
22
|
-
const currentDir =
|
|
22
|
+
const currentDir = getProjectDirFromSystemUtils();
|
|
23
23
|
if (gslothDirExists()) {
|
|
24
24
|
const gslothDirPath = resolve(currentDir, GSLOTH_DIR);
|
|
25
25
|
return resolve(gslothDirPath, filename);
|
|
@@ -38,7 +38,7 @@ export function getGslothFilePath(filename) {
|
|
|
38
38
|
* @returns The resolved path where the configuration file should be written
|
|
39
39
|
*/
|
|
40
40
|
export function getGslothConfigWritePath(filename) {
|
|
41
|
-
const currentDir =
|
|
41
|
+
const currentDir = getProjectDirFromSystemUtils();
|
|
42
42
|
if (gslothDirExists()) {
|
|
43
43
|
const gslothDirPath = resolve(currentDir, GSLOTH_DIR);
|
|
44
44
|
const gslothSettingsPath = resolve(gslothDirPath, GSLOTH_SETTINGS_DIR);
|
|
@@ -56,7 +56,7 @@ export function getGslothConfigWritePath(filename) {
|
|
|
56
56
|
* @returns The resolved path where the configuration file should be found
|
|
57
57
|
*/
|
|
58
58
|
export function getGslothConfigReadPath(filename) {
|
|
59
|
-
const projectDir =
|
|
59
|
+
const projectDir = getProjectDirFromSystemUtils();
|
|
60
60
|
if (gslothDirExists()) {
|
|
61
61
|
const gslothDirPath = resolve(projectDir, GSLOTH_DIR);
|
|
62
62
|
const gslothSettingsPath = resolve(gslothDirPath, GSLOTH_SETTINGS_DIR);
|
|
@@ -74,7 +74,7 @@ export function getGslothConfigReadPath(filename) {
|
|
|
74
74
|
* - If it's a bare filename, place it under .gsloth/ when present, otherwise project root.
|
|
75
75
|
*/
|
|
76
76
|
export function resolveOutputPath(writeOutputToFile) {
|
|
77
|
-
const currentDir =
|
|
77
|
+
const currentDir = getProjectDirFromSystemUtils();
|
|
78
78
|
const provided = String(writeOutputToFile).trim();
|
|
79
79
|
// Detect if provided path contains path separators (cross-platform)
|
|
80
80
|
const hasSeparator = provided.includes('/') || provided.includes('\\');
|
|
@@ -111,4 +111,137 @@ export function getCommandOutputFilePath(config, source) {
|
|
|
111
111
|
const filename = generateStandardFileName(source.toUpperCase());
|
|
112
112
|
return getGslothFilePath(filename);
|
|
113
113
|
}
|
|
114
|
+
const internalPathState = {
|
|
115
|
+
installDir: undefined,
|
|
116
|
+
};
|
|
117
|
+
// -----------------------------------------------------------------------------
|
|
118
|
+
// Functions from globalConfigUtils.ts
|
|
119
|
+
// -----------------------------------------------------------------------------
|
|
120
|
+
/**
|
|
121
|
+
* Gets the global .gsloth directory path in the user's home directory
|
|
122
|
+
* @returns The resolved path to the global .gsloth directory
|
|
123
|
+
*/
|
|
124
|
+
export function getGlobalGslothDir() {
|
|
125
|
+
return resolve(homedir(), GSLOTH_DIR);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Ensures the global .gsloth directory exists in the user's home directory
|
|
129
|
+
* Creates it if it doesn't exist
|
|
130
|
+
* @returns The resolved path to the global .gsloth directory
|
|
131
|
+
*/
|
|
132
|
+
export function ensureGlobalGslothDir() {
|
|
133
|
+
const globalDir = getGlobalGslothDir();
|
|
134
|
+
if (!existsSync(globalDir)) {
|
|
135
|
+
mkdirSync(globalDir, { recursive: true });
|
|
136
|
+
}
|
|
137
|
+
return globalDir;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Gets the global auth directory path
|
|
141
|
+
* @returns The resolved path to the global auth directory
|
|
142
|
+
*/
|
|
143
|
+
export function getGlobalAuthDir() {
|
|
144
|
+
const globalDir = getGlobalGslothDir();
|
|
145
|
+
return resolve(globalDir, GSLOTH_AUTH);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Ensures the global auth directory exists
|
|
149
|
+
* Creates it if it doesn't exist
|
|
150
|
+
* @returns The resolved path to the global auth directory
|
|
151
|
+
*/
|
|
152
|
+
export function ensureGlobalAuthDir() {
|
|
153
|
+
// First ensure parent directory exists
|
|
154
|
+
ensureGlobalGslothDir();
|
|
155
|
+
const authDir = getGlobalAuthDir();
|
|
156
|
+
if (!existsSync(authDir)) {
|
|
157
|
+
mkdirSync(authDir, { recursive: true });
|
|
158
|
+
}
|
|
159
|
+
return authDir;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Gets the path for a specific OAuth provider's storage file
|
|
163
|
+
* @param serverUrl The server URL or identifier for the OAuth provider
|
|
164
|
+
* @returns The resolved path where the OAuth data should be stored
|
|
165
|
+
*/
|
|
166
|
+
export function getOAuthStoragePath(serverUrl) {
|
|
167
|
+
const authDir = ensureGlobalAuthDir();
|
|
168
|
+
// Create a safe filename from the server URL
|
|
169
|
+
const safeFilename = serverUrl
|
|
170
|
+
.replace(/https?:\/\//, '')
|
|
171
|
+
.replace(/[^a-zA-Z0-9.-]/g, '_')
|
|
172
|
+
.replace(/_+/g, '_')
|
|
173
|
+
.toLowerCase();
|
|
174
|
+
return resolve(authDir, `${safeFilename}.json`);
|
|
175
|
+
}
|
|
176
|
+
// -----------------------------------------------------------------------------
|
|
177
|
+
// Functions from systemUtils.ts
|
|
178
|
+
// -----------------------------------------------------------------------------
|
|
179
|
+
/**
|
|
180
|
+
* Gets the current project directory (internal implementation for pathUtils)
|
|
181
|
+
* @returns The current working directory
|
|
182
|
+
*/
|
|
183
|
+
const getProjectDirInternal = () => process.cwd();
|
|
184
|
+
/**
|
|
185
|
+
* Gets the current project directory
|
|
186
|
+
* @returns The current working directory
|
|
187
|
+
*/
|
|
188
|
+
export const getProjectDir = getProjectDirInternal;
|
|
189
|
+
/**
|
|
190
|
+
* Gets the installation directory
|
|
191
|
+
* @returns The installation directory path
|
|
192
|
+
* @throws Error if install directory not set
|
|
193
|
+
*/
|
|
194
|
+
export const getInstallDir = () => {
|
|
195
|
+
if (internalPathState.installDir) {
|
|
196
|
+
return internalPathState.installDir;
|
|
197
|
+
}
|
|
198
|
+
throw new Error('Install directory not set');
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Provide the path to the entry point of the application.
|
|
202
|
+
* This is used to set the install directory.
|
|
203
|
+
* This is called from cli.js root entry point.
|
|
204
|
+
* @param indexJs The path to the entry point file
|
|
205
|
+
*/
|
|
206
|
+
export const setEntryPoint = (indexJs) => {
|
|
207
|
+
const filePath = fileURLToPath(indexJs);
|
|
208
|
+
const dirPath = dirname(filePath);
|
|
209
|
+
internalPathState.installDir = resolve(dirPath);
|
|
210
|
+
};
|
|
211
|
+
// -----------------------------------------------------------------------------
|
|
212
|
+
// Functions from utils.ts
|
|
213
|
+
// -----------------------------------------------------------------------------
|
|
214
|
+
/**
|
|
215
|
+
* Converts a string to a file-safe format by replacing non-alphanumeric characters with dashes
|
|
216
|
+
* @param string The string to convert
|
|
217
|
+
* @returns A file-safe string
|
|
218
|
+
*/
|
|
219
|
+
export function toFileSafeString(string) {
|
|
220
|
+
return string.replace(/[^A-Za-z0-9]/g, '-');
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Returns a formatted date string in the format YYYY-MM-DD_HH-MM-SS using local time
|
|
224
|
+
* @returns A formatted date string
|
|
225
|
+
*/
|
|
226
|
+
export function fileSafeLocalDate() {
|
|
227
|
+
const date = new Date();
|
|
228
|
+
// Format: YYYY-MM-DD_HH-MM-SS using local time directly
|
|
229
|
+
const year = date.getFullYear();
|
|
230
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
231
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
232
|
+
const hours = String(date.getHours()).padStart(2, '0');
|
|
233
|
+
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
234
|
+
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
235
|
+
return `${year}-${month}-${day}_${hours}-${minutes}-${seconds}`;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Generates a standardized filename with the format: gth_YYYY-MM-DD_HH-MM-SS_COMMAND.md
|
|
239
|
+
* @param command - The command that created the file (ASK, REVIEW, PR, etc.)
|
|
240
|
+
* @returns A standardized filename string
|
|
241
|
+
*/
|
|
242
|
+
export function generateStandardFileName(command) {
|
|
243
|
+
const dateTimeStr = fileSafeLocalDate();
|
|
244
|
+
const commandStr = toFileSafeString(command.toUpperCase());
|
|
245
|
+
return `gth_${dateTimeStr}_${commandStr}.md`;
|
|
246
|
+
}
|
|
114
247
|
//# sourceMappingURL=pathUtils.js.map
|
package/dist/pathUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pathUtils.js","sourceRoot":"","sources":["../src/pathUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"pathUtils.js","sourceRoot":"","sources":["../src/pathUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,IAAI,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACpF,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGjF;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,UAAU,GAAG,4BAA4B,EAAE,CAAC;IAClD,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IACtD,OAAO,UAAU,CAAC,aAAa,CAAC,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,MAAM,UAAU,GAAG,4BAA4B,EAAE,CAAC;IAElD,IAAI,eAAe,EAAE,EAAE,CAAC;QACtB,MAAM,aAAa,GAAG,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,OAAO,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AACvC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAAgB;IACvD,MAAM,UAAU,GAAG,4BAA4B,EAAE,CAAC;IAElD,IAAI,eAAe,EAAE,EAAE,CAAC;QACtB,MAAM,aAAa,GAA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AAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAE3D,OAAO,GAAG,IAAI,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;AAClE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,OAAe;IACtD,MAAM,WAAW,GAAG,iBAAiB,EAAE,CAAC;IACxC,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAE3D,OAAO,OAAO,WAAW,IAAI,UAAU,KAAK,CAAC;AAC/C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { displayInfo, displayWarning } from '#src/consoleUtils.js';
|
|
2
|
-
import { debugLog, debugLogError } from '#src/
|
|
2
|
+
import { debugLog, debugLogError } from '#src/consoleUtils.js';
|
|
3
3
|
import { env } from '#src/systemUtils.js';
|
|
4
4
|
import { writeFileIfNotExistsWithMessages } from '#src/utils.js';
|
|
5
5
|
import { isAIMessage } from '@langchain/core/messages';
|