@proteinjs/conversation 1.0.1 → 1.0.3
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/CHANGELOG.md +16 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/src/CodegenConversation.d.ts +13 -0
- package/dist/src/CodegenConversation.d.ts.map +1 -0
- package/dist/src/CodegenConversation.js +128 -57
- package/dist/src/CodegenConversation.js.map +1 -0
- package/dist/src/Conversation.d.ts +60 -0
- package/dist/src/Conversation.d.ts.map +1 -0
- package/dist/src/Conversation.js +202 -102
- package/dist/src/Conversation.js.map +1 -0
- package/dist/src/ConversationModule.d.ts +12 -0
- package/dist/src/ConversationModule.d.ts.map +1 -0
- package/dist/src/ConversationModule.js +1 -0
- package/dist/src/ConversationModule.js.map +1 -0
- package/dist/src/Function.d.ts +7 -0
- package/dist/src/Function.d.ts.map +1 -0
- package/dist/src/Function.js +1 -0
- package/dist/src/Function.js.map +1 -0
- package/dist/src/OpenAi.d.ts +18 -0
- package/dist/src/OpenAi.d.ts.map +1 -0
- package/dist/src/OpenAi.js +265 -169
- package/dist/src/OpenAi.js.map +1 -0
- package/dist/src/Paragraph.d.ts +7 -0
- package/dist/src/Paragraph.d.ts.map +1 -0
- package/dist/src/Paragraph.js +9 -7
- package/dist/src/Paragraph.js.map +1 -0
- package/dist/src/Sentence.d.ts +6 -0
- package/dist/src/Sentence.d.ts.map +1 -0
- package/dist/src/Sentence.js +10 -8
- package/dist/src/Sentence.js.map +1 -0
- package/dist/src/code_template/Code.d.ts +24 -0
- package/dist/src/code_template/Code.d.ts.map +1 -0
- package/dist/src/code_template/Code.js +57 -22
- package/dist/src/code_template/Code.js.map +1 -0
- package/dist/src/code_template/CodeTemplate.d.ts +18 -0
- package/dist/src/code_template/CodeTemplate.d.ts.map +1 -0
- package/dist/src/code_template/CodeTemplate.js +68 -20
- package/dist/src/code_template/CodeTemplate.js.map +1 -0
- package/dist/src/code_template/CodeTemplateModule.d.ts +11 -0
- package/dist/src/code_template/CodeTemplateModule.d.ts.map +1 -0
- package/dist/src/code_template/CodeTemplateModule.js +20 -16
- package/dist/src/code_template/CodeTemplateModule.js.map +1 -0
- package/dist/src/code_template/Repo.d.ts +50 -0
- package/dist/src/code_template/Repo.d.ts.map +1 -0
- package/dist/src/code_template/Repo.js +161 -80
- package/dist/src/code_template/Repo.js.map +1 -0
- package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts +24 -0
- package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts.map +1 -0
- package/dist/src/fs/conversation_fs/ConversationFsModerator.js +45 -36
- package/dist/src/fs/conversation_fs/ConversationFsModerator.js.map +1 -0
- package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts +18 -0
- package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts.map +1 -0
- package/dist/src/fs/conversation_fs/ConversationFsModule.js +84 -41
- package/dist/src/fs/conversation_fs/ConversationFsModule.js.map +1 -0
- package/dist/src/fs/conversation_fs/FsFunctions.d.ts +82 -0
- package/dist/src/fs/conversation_fs/FsFunctions.d.ts.map +1 -0
- package/dist/src/fs/conversation_fs/FsFunctions.js +105 -30
- package/dist/src/fs/conversation_fs/FsFunctions.js.map +1 -0
- package/dist/src/fs/git/GitModule.d.ts +14 -0
- package/dist/src/fs/git/GitModule.d.ts.map +1 -0
- package/dist/src/fs/git/GitModule.js +65 -24
- package/dist/src/fs/git/GitModule.js.map +1 -0
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts +23 -0
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts.map +1 -0
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js +35 -5
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js.map +1 -0
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts +34 -0
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts.map +1 -0
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js +107 -50
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js.map +1 -0
- package/dist/src/fs/package/PackageFunctions.d.ts +79 -0
- package/dist/src/fs/package/PackageFunctions.d.ts.map +1 -0
- package/dist/src/fs/package/PackageFunctions.js +78 -16
- package/dist/src/fs/package/PackageFunctions.js.map +1 -0
- package/dist/src/fs/package/PackageModule.d.ts +34 -0
- package/dist/src/fs/package/PackageModule.d.ts.map +1 -0
- package/dist/src/fs/package/PackageModule.js +135 -62
- package/dist/src/fs/package/PackageModule.js.map +1 -0
- package/dist/src/history/MessageHistory.d.ts +17 -0
- package/dist/src/history/MessageHistory.d.ts.map +1 -0
- package/dist/src/history/MessageHistory.js +25 -22
- package/dist/src/history/MessageHistory.js.map +1 -0
- package/dist/src/history/MessageModerator.d.ts +5 -0
- package/dist/src/history/MessageModerator.d.ts.map +1 -0
- package/dist/src/history/MessageModerator.js +1 -0
- package/dist/src/history/MessageModerator.js.map +1 -0
- package/dist/src/template/ConversationTemplate.d.ts +12 -0
- package/dist/src/template/ConversationTemplate.d.ts.map +1 -0
- package/dist/src/template/ConversationTemplate.js +1 -0
- package/dist/src/template/ConversationTemplate.js.map +1 -0
- package/dist/src/template/ConversationTemplateFunctions.d.ts +44 -0
- package/dist/src/template/ConversationTemplateFunctions.d.ts.map +1 -0
- package/dist/src/template/ConversationTemplateFunctions.js +39 -4
- package/dist/src/template/ConversationTemplateFunctions.js.map +1 -0
- package/dist/src/template/ConversationTemplateModule.d.ts +65 -0
- package/dist/src/template/ConversationTemplateModule.d.ts.map +1 -0
- package/dist/src/template/ConversationTemplateModule.js +92 -47
- package/dist/src/template/ConversationTemplateModule.js.map +1 -0
- package/dist/src/template/createApp/CreateAppTemplate.d.ts +3 -0
- package/dist/src/template/createApp/CreateAppTemplate.d.ts.map +1 -0
- package/dist/src/template/createApp/CreateAppTemplate.js +44 -14
- package/dist/src/template/createApp/CreateAppTemplate.js.map +1 -0
- package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts +3 -0
- package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts.map +1 -0
- package/dist/src/template/createCode/CreateCodeConversationTemplate.js +56 -26
- package/dist/src/template/createCode/CreateCodeConversationTemplate.js.map +1 -0
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts +3 -0
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts.map +1 -0
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.js +63 -26
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.js.map +1 -0
- package/dist/test/createKeywordFilesIndex.test.d.ts +2 -0
- package/dist/test/createKeywordFilesIndex.test.d.ts.map +1 -0
- package/dist/test/createKeywordFilesIndex.test.js +37 -6
- package/dist/test/createKeywordFilesIndex.test.js.map +1 -0
- package/dist/test/openai/openai.generateList.test.d.ts +2 -0
- package/dist/test/openai/openai.generateList.test.d.ts.map +1 -0
- package/dist/test/openai/openai.generateList.test.js +43 -5
- package/dist/test/openai/openai.generateList.test.js.map +1 -0
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.d.ts +2 -0
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.d.ts.map +1 -0
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.js +11 -10
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.js.map +1 -0
- package/dist/test/repo/repo.test.d.ts +2 -0
- package/dist/test/repo/repo.test.d.ts.map +1 -0
- package/dist/test/repo/repo.test.js +33 -4
- package/dist/test/repo/repo.test.js.map +1 -0
- package/package.json +4 -3
- package/tsconfig.json +20 -106
- package/dist/jest.config.js +0 -10
- package/dist/src/template/createPackage/jest.config.js +0 -10
- package/dist/test/setup.js +0 -1
|
@@ -8,61 +8,104 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
+
if (ar || !(i in from)) {
|
|
41
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
+
ar[i] = from[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
+
};
|
|
11
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
48
|
exports.ConversationFsModuleFactory = exports.ConversationFsModule = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
49
|
+
var KeywordToFilesIndexFunctions_1 = require("../keyword_to_files_index/KeywordToFilesIndexFunctions");
|
|
50
|
+
var PackageFunctions_1 = require("../package/PackageFunctions");
|
|
51
|
+
var ConversationFsModerator_1 = require("./ConversationFsModerator");
|
|
52
|
+
var FsFunctions_1 = require("./FsFunctions");
|
|
53
|
+
var ConversationFsModule = /** @class */ (function () {
|
|
54
|
+
function ConversationFsModule(repoPath) {
|
|
19
55
|
this.recentlyAccessedFilePaths = [];
|
|
20
56
|
this.repoPath = repoPath;
|
|
21
57
|
}
|
|
22
|
-
getName() {
|
|
58
|
+
ConversationFsModule.prototype.getName = function () {
|
|
23
59
|
return 'Conversation Fs';
|
|
24
|
-
}
|
|
25
|
-
getSystemMessages() {
|
|
60
|
+
};
|
|
61
|
+
ConversationFsModule.prototype.getSystemMessages = function () {
|
|
26
62
|
return [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
63
|
+
"Assume the current working directory is: ".concat(this.repoPath, " unless specified by the user"),
|
|
64
|
+
"Pre-pend the current working directory as the base path to file paths when performing file operations, unless specified otherwise by the user",
|
|
65
|
+
"If the user asks to change the cwd, do not create a new folder, just fail if it's not a valid path",
|
|
66
|
+
"If the user wants to work in a package, use the ".concat(PackageFunctions_1.searchPackagesFunctionName, " function and take the directory from the package.json file path and make that the cwd"),
|
|
67
|
+
"You have access to code in a local repo, you can read and write code to and from the file system with the ".concat(FsFunctions_1.readFilesFunctionName, " function and the ").concat(FsFunctions_1.writeFilesFunctionName, " function"),
|
|
68
|
+
"Before writing to a file that already exists, read the file first and make your changes to its contents",
|
|
69
|
+
"When reading/writing a file in a specified package, join the package directory with the relative path to form the file path",
|
|
70
|
+
"When searching for source files, do not look in the dist or node_modules directories",
|
|
71
|
+
"If you don't know a file path, don't try to guess it, use the ".concat(KeywordToFilesIndexFunctions_1.searchFilesFunctionName, " function to find it"),
|
|
72
|
+
"When searching for something (ie. a file to work with/in), unless more context is specified, use the ".concat(PackageFunctions_1.searchLibrariesFunctionName, " function first, then fall back to functions: ").concat(PackageFunctions_1.searchPackagesFunctionName, ", ").concat(KeywordToFilesIndexFunctions_1.searchFilesFunctionName),
|
|
73
|
+
"After finding a file to work with, assume the user's following question pertains to that file and use ".concat(FsFunctions_1.readFilesFunctionName, " to read the file if needed"),
|
|
38
74
|
];
|
|
39
|
-
}
|
|
40
|
-
getFunctions() {
|
|
41
|
-
return [
|
|
75
|
+
};
|
|
76
|
+
ConversationFsModule.prototype.getFunctions = function () {
|
|
77
|
+
return __spreadArray([
|
|
42
78
|
(0, FsFunctions_1.readFilesFunction)(this),
|
|
43
79
|
(0, FsFunctions_1.writeFilesFunction)(this),
|
|
44
|
-
(0, FsFunctions_1.getRecentlyAccessedFilePathsFunction)(this)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
getMessageModerators() {
|
|
80
|
+
(0, FsFunctions_1.getRecentlyAccessedFilePathsFunction)(this)
|
|
81
|
+
], FsFunctions_1.fsFunctions, true);
|
|
82
|
+
};
|
|
83
|
+
ConversationFsModule.prototype.getMessageModerators = function () {
|
|
49
84
|
return [
|
|
50
85
|
new ConversationFsModerator_1.ConversationFsModerator(),
|
|
51
86
|
];
|
|
52
|
-
}
|
|
53
|
-
pushRecentlyAccessedFilePath(filePaths) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
87
|
+
};
|
|
88
|
+
ConversationFsModule.prototype.pushRecentlyAccessedFilePath = function (filePaths) {
|
|
89
|
+
var _a;
|
|
90
|
+
(_a = this.recentlyAccessedFilePaths).push.apply(_a, filePaths);
|
|
91
|
+
};
|
|
92
|
+
ConversationFsModule.prototype.getRecentlyAccessedFilePaths = function () {
|
|
57
93
|
return this.recentlyAccessedFilePaths;
|
|
58
|
-
}
|
|
59
|
-
|
|
94
|
+
};
|
|
95
|
+
return ConversationFsModule;
|
|
96
|
+
}());
|
|
60
97
|
exports.ConversationFsModule = ConversationFsModule;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
-
return new ConversationFsModule(repoPath);
|
|
65
|
-
});
|
|
98
|
+
var ConversationFsModuleFactory = /** @class */ (function () {
|
|
99
|
+
function ConversationFsModuleFactory() {
|
|
66
100
|
}
|
|
67
|
-
|
|
101
|
+
ConversationFsModuleFactory.prototype.createModule = function (repoPath) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
103
|
+
return __generator(this, function (_a) {
|
|
104
|
+
return [2 /*return*/, new ConversationFsModule(repoPath)];
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
return ConversationFsModuleFactory;
|
|
109
|
+
}());
|
|
68
110
|
exports.ConversationFsModuleFactory = ConversationFsModuleFactory;
|
|
111
|
+
//# sourceMappingURL=ConversationFsModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationFsModule.js","sourceRoot":"","sources":["../../../../src/fs/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DAAY,GAAlB,UAAmB,QAAgB;;;gBACjC,sBAAO,IAAI,oBAAoB,CAAC,QAAQ,CAAC,EAAC;;;KAC3C;IACH,kCAAC;AAAD,CAAC,AAJD,IAIC;AAJY,kEAA2B"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { File } from '@proteinjs/util-node';
|
|
2
|
+
import { Function } from '../../Function';
|
|
3
|
+
import { ConversationFsModule } from './ConversationFsModule';
|
|
4
|
+
export declare const readFilesFunctionName = "readFiles";
|
|
5
|
+
export declare function readFilesFunction(fsModule: ConversationFsModule): {
|
|
6
|
+
definition: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
parameters: {
|
|
10
|
+
type: string;
|
|
11
|
+
properties: {
|
|
12
|
+
filePaths: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
items: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
required: string[];
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
call: (params: {
|
|
24
|
+
filePaths: string[];
|
|
25
|
+
}) => Promise<import("@proteinjs/util-node").FileContentMap>;
|
|
26
|
+
instructions: string[];
|
|
27
|
+
};
|
|
28
|
+
export declare const writeFilesFunctionName = "writeFiles";
|
|
29
|
+
export declare function writeFilesFunction(fsModule: ConversationFsModule): {
|
|
30
|
+
definition: {
|
|
31
|
+
name: string;
|
|
32
|
+
description: string;
|
|
33
|
+
parameters: {
|
|
34
|
+
type: string;
|
|
35
|
+
properties: {
|
|
36
|
+
files: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
items: {
|
|
40
|
+
type: string;
|
|
41
|
+
properties: {
|
|
42
|
+
path: {
|
|
43
|
+
type: string;
|
|
44
|
+
description: string;
|
|
45
|
+
};
|
|
46
|
+
content: {
|
|
47
|
+
type: string;
|
|
48
|
+
description: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
required: string[];
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
call: (params: {
|
|
58
|
+
files: File[];
|
|
59
|
+
}) => Promise<void>;
|
|
60
|
+
instructions: string[];
|
|
61
|
+
};
|
|
62
|
+
export declare const getRecentlyAccessedFilePathsFunctionName = "getRecentlyAccessedFilePaths";
|
|
63
|
+
export declare function getRecentlyAccessedFilePathsFunction(fsModule: ConversationFsModule): {
|
|
64
|
+
definition: {
|
|
65
|
+
name: string;
|
|
66
|
+
description: string;
|
|
67
|
+
parameters: {
|
|
68
|
+
type: string;
|
|
69
|
+
properties: {};
|
|
70
|
+
required: never[];
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
call: () => Promise<string[]>;
|
|
74
|
+
};
|
|
75
|
+
export declare const fileOrDirectoryExistsFunctionName = "fileOrDirectoryExists";
|
|
76
|
+
export declare const fileOrDirectoryExistsFunction: Function;
|
|
77
|
+
export declare const getFilePathsMatchingGlobFunctionName = "getFilePathsMatchingGlob";
|
|
78
|
+
export declare const renameFunctionName = "renameFileOrDirectory";
|
|
79
|
+
export declare const copyFunctionName = "copyFileOrDirectory";
|
|
80
|
+
export declare const moveFunctionName = "moveFileOrDirectory";
|
|
81
|
+
export declare const fsFunctions: Function[];
|
|
82
|
+
//# sourceMappingURL=FsFunctions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsFunctions.d.ts","sourceRoot":"","sources":["../../../../src/fs/conversation_fs/FsFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAM,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,eAAO,MAAM,qBAAqB,cAAc,CAAC;AACjD,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;;;;;;;;;mBAmBvC;QAAE,SAAS,EAAE,MAAM,EAAE,CAAA;KAAE;;EAQ/C;AAED,eAAO,MAAM,sBAAsB,eAAe,CAAC;AACnD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA6BxC;QAAE,KAAK,EAAE,IAAI,EAAE,CAAA;KAAE;;EAQzC;AAED,eAAO,MAAM,wCAAwC,iCAAiC,CAAC;AACvF,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE,oBAAoB;;;;;;;;;;;EAalF;AAwBD,eAAO,MAAM,iCAAiC,0BAA0B,CAAC;AACzE,eAAO,MAAM,6BAA6B,EAAE,QAmB3C,CAAA;AAED,eAAO,MAAM,oCAAoC,6BAA6B,CAAC;AAiC/E,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AA0B1D,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AA0BtD,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AA0BtD,eAAO,MAAM,WAAW,EAAE,QAAQ,EAOjC,CAAA"}
|
|
@@ -8,11 +8,39 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
11
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
39
|
exports.fsFunctions = exports.moveFunctionName = exports.copyFunctionName = exports.renameFunctionName = exports.getFilePathsMatchingGlobFunctionName = exports.fileOrDirectoryExistsFunction = exports.fileOrDirectoryExistsFunctionName = exports.getRecentlyAccessedFilePathsFunction = exports.getRecentlyAccessedFilePathsFunctionName = exports.writeFilesFunction = exports.writeFilesFunctionName = exports.readFilesFunction = exports.readFilesFunctionName = void 0;
|
|
13
|
-
|
|
40
|
+
var util_node_1 = require("@proteinjs/util-node");
|
|
14
41
|
exports.readFilesFunctionName = 'readFiles';
|
|
15
42
|
function readFilesFunction(fsModule) {
|
|
43
|
+
var _this = this;
|
|
16
44
|
return {
|
|
17
45
|
definition: {
|
|
18
46
|
name: exports.readFilesFunctionName,
|
|
@@ -31,18 +59,25 @@ function readFilesFunction(fsModule) {
|
|
|
31
59
|
required: ['filePaths']
|
|
32
60
|
},
|
|
33
61
|
},
|
|
34
|
-
call: (params)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
62
|
+
call: function (params) { return __awaiter(_this, void 0, void 0, function () {
|
|
63
|
+
return __generator(this, function (_a) {
|
|
64
|
+
switch (_a.label) {
|
|
65
|
+
case 0:
|
|
66
|
+
fsModule.pushRecentlyAccessedFilePath(params.filePaths);
|
|
67
|
+
return [4 /*yield*/, util_node_1.Fs.readFiles(params.filePaths)];
|
|
68
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}); },
|
|
38
72
|
instructions: [
|
|
39
|
-
|
|
73
|
+
"To read files from the local file system, use the ".concat(exports.readFilesFunctionName, " function"),
|
|
40
74
|
],
|
|
41
75
|
};
|
|
42
76
|
}
|
|
43
77
|
exports.readFilesFunction = readFilesFunction;
|
|
44
78
|
exports.writeFilesFunctionName = 'writeFiles';
|
|
45
79
|
function writeFilesFunction(fsModule) {
|
|
80
|
+
var _this = this;
|
|
46
81
|
return {
|
|
47
82
|
definition: {
|
|
48
83
|
name: exports.writeFilesFunctionName,
|
|
@@ -71,18 +106,25 @@ function writeFilesFunction(fsModule) {
|
|
|
71
106
|
required: ['files']
|
|
72
107
|
},
|
|
73
108
|
},
|
|
74
|
-
call: (params)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
109
|
+
call: function (params) { return __awaiter(_this, void 0, void 0, function () {
|
|
110
|
+
return __generator(this, function (_a) {
|
|
111
|
+
switch (_a.label) {
|
|
112
|
+
case 0:
|
|
113
|
+
fsModule.pushRecentlyAccessedFilePath(params.files.map(function (file) { return file.path; }));
|
|
114
|
+
return [4 /*yield*/, util_node_1.Fs.writeFiles(params.files)];
|
|
115
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}); },
|
|
78
119
|
instructions: [
|
|
79
|
-
|
|
120
|
+
"To write files to the local file system, use the ".concat(exports.writeFilesFunctionName, " function"),
|
|
80
121
|
],
|
|
81
122
|
};
|
|
82
123
|
}
|
|
83
124
|
exports.writeFilesFunction = writeFilesFunction;
|
|
84
125
|
exports.getRecentlyAccessedFilePathsFunctionName = 'getRecentlyAccessedFilePaths';
|
|
85
126
|
function getRecentlyAccessedFilePathsFunction(fsModule) {
|
|
127
|
+
var _this = this;
|
|
86
128
|
return {
|
|
87
129
|
definition: {
|
|
88
130
|
name: exports.getRecentlyAccessedFilePathsFunctionName,
|
|
@@ -93,12 +135,14 @@ function getRecentlyAccessedFilePathsFunction(fsModule) {
|
|
|
93
135
|
required: [],
|
|
94
136
|
},
|
|
95
137
|
},
|
|
96
|
-
call: ()
|
|
138
|
+
call: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
139
|
+
return [2 /*return*/, fsModule.getRecentlyAccessedFilePaths()];
|
|
140
|
+
}); }); },
|
|
97
141
|
};
|
|
98
142
|
}
|
|
99
143
|
exports.getRecentlyAccessedFilePathsFunction = getRecentlyAccessedFilePathsFunction;
|
|
100
|
-
|
|
101
|
-
|
|
144
|
+
var createFolderFunctionName = 'createFolder';
|
|
145
|
+
var createFolderFunction = {
|
|
102
146
|
definition: {
|
|
103
147
|
name: createFolderFunctionName,
|
|
104
148
|
description: 'Create a folder/directory',
|
|
@@ -113,9 +157,14 @@ const createFolderFunction = {
|
|
|
113
157
|
required: ['path']
|
|
114
158
|
},
|
|
115
159
|
},
|
|
116
|
-
call: (params)
|
|
160
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
161
|
+
switch (_a.label) {
|
|
162
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.createFolder(params.path)];
|
|
163
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
164
|
+
}
|
|
165
|
+
}); }); },
|
|
117
166
|
instructions: [
|
|
118
|
-
|
|
167
|
+
"To create a folder on the local file system, use the ".concat(createFolderFunctionName, " function"),
|
|
119
168
|
],
|
|
120
169
|
};
|
|
121
170
|
exports.fileOrDirectoryExistsFunctionName = 'fileOrDirectoryExists';
|
|
@@ -134,13 +183,18 @@ exports.fileOrDirectoryExistsFunction = {
|
|
|
134
183
|
required: ['path']
|
|
135
184
|
},
|
|
136
185
|
},
|
|
137
|
-
call: (params)
|
|
186
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
187
|
+
switch (_a.label) {
|
|
188
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.exists(params.path)];
|
|
189
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
190
|
+
}
|
|
191
|
+
}); }); },
|
|
138
192
|
instructions: [
|
|
139
|
-
|
|
193
|
+
"To check if a file or folder exists on the local file system, use the ".concat(exports.fileOrDirectoryExistsFunctionName, " function"),
|
|
140
194
|
],
|
|
141
195
|
};
|
|
142
196
|
exports.getFilePathsMatchingGlobFunctionName = 'getFilePathsMatchingGlob';
|
|
143
|
-
|
|
197
|
+
var getFilePathsMatchingGlobFunction = {
|
|
144
198
|
definition: {
|
|
145
199
|
name: exports.getFilePathsMatchingGlobFunctionName,
|
|
146
200
|
description: 'Get file paths matching a glob',
|
|
@@ -166,13 +220,18 @@ const getFilePathsMatchingGlobFunction = {
|
|
|
166
220
|
required: ['dirPrefix', 'glob']
|
|
167
221
|
},
|
|
168
222
|
},
|
|
169
|
-
call: (params)
|
|
223
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
224
|
+
switch (_a.label) {
|
|
225
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.getFilePathsMatchingGlob(params.dirPrefix, params.glob, params.globIgnorePatterns)];
|
|
226
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
227
|
+
}
|
|
228
|
+
}); }); },
|
|
170
229
|
instructions: [
|
|
171
|
-
|
|
230
|
+
"To get file paths matching a glob, use the ".concat(exports.getFilePathsMatchingGlobFunctionName, " function"),
|
|
172
231
|
],
|
|
173
232
|
};
|
|
174
233
|
exports.renameFunctionName = 'renameFileOrDirectory';
|
|
175
|
-
|
|
234
|
+
var renameFunction = {
|
|
176
235
|
definition: {
|
|
177
236
|
name: exports.renameFunctionName,
|
|
178
237
|
description: 'Rename a file or directory',
|
|
@@ -191,13 +250,18 @@ const renameFunction = {
|
|
|
191
250
|
required: ['oldPath', 'newName']
|
|
192
251
|
},
|
|
193
252
|
},
|
|
194
|
-
call: (params)
|
|
253
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
254
|
+
switch (_a.label) {
|
|
255
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.rename(params.oldPath, params.newName)];
|
|
256
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
257
|
+
}
|
|
258
|
+
}); }); },
|
|
195
259
|
instructions: [
|
|
196
|
-
|
|
260
|
+
"To rename a file or directory, use the ".concat(exports.renameFunctionName, " function"),
|
|
197
261
|
],
|
|
198
262
|
};
|
|
199
263
|
exports.copyFunctionName = 'copyFileOrDirectory';
|
|
200
|
-
|
|
264
|
+
var copyFunction = {
|
|
201
265
|
definition: {
|
|
202
266
|
name: exports.copyFunctionName,
|
|
203
267
|
description: 'Copy a file or directory',
|
|
@@ -216,13 +280,18 @@ const copyFunction = {
|
|
|
216
280
|
required: ['sourcePath', 'destinationPath']
|
|
217
281
|
},
|
|
218
282
|
},
|
|
219
|
-
call: (params)
|
|
283
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
284
|
+
switch (_a.label) {
|
|
285
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.copy(params.sourcePath, params.destinationPath)];
|
|
286
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
287
|
+
}
|
|
288
|
+
}); }); },
|
|
220
289
|
instructions: [
|
|
221
|
-
|
|
290
|
+
"To copy a file or directory, use the ".concat(exports.copyFunctionName, " function"),
|
|
222
291
|
],
|
|
223
292
|
};
|
|
224
293
|
exports.moveFunctionName = 'moveFileOrDirectory';
|
|
225
|
-
|
|
294
|
+
var moveFunction = {
|
|
226
295
|
definition: {
|
|
227
296
|
name: exports.moveFunctionName,
|
|
228
297
|
description: 'Move a file or directory',
|
|
@@ -241,9 +310,14 @@ const moveFunction = {
|
|
|
241
310
|
required: ['sourcePath', 'destinationPath']
|
|
242
311
|
},
|
|
243
312
|
},
|
|
244
|
-
call: (params)
|
|
313
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
314
|
+
switch (_a.label) {
|
|
315
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.move(params.sourcePath, params.destinationPath)];
|
|
316
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
317
|
+
}
|
|
318
|
+
}); }); },
|
|
245
319
|
instructions: [
|
|
246
|
-
|
|
320
|
+
"To move a file or directory, use the ".concat(exports.moveFunctionName, " function"),
|
|
247
321
|
],
|
|
248
322
|
};
|
|
249
323
|
exports.fsFunctions = [
|
|
@@ -254,3 +328,4 @@ exports.fsFunctions = [
|
|
|
254
328
|
copyFunction,
|
|
255
329
|
moveFunction,
|
|
256
330
|
];
|
|
331
|
+
//# sourceMappingURL=FsFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FsFunctions.js","sourceRoot":"","sources":["../../../../src/fs/conversation_fs/FsFunctions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAgD;AAInC,QAAA,qBAAqB,GAAG,WAAW,CAAC;AACjD,SAAgB,iBAAiB,CAAC,QAA8B;IAAhE,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M,cAAE,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,eAAe,CAAC,EAAA;oBAAxD,sBAAA,SAAwD,EAAA;;aAAA;IACjI,YAAY,EAAE;QACZ,+CAAwC,wBAAgB,cAAW;KACpE;CACF,CAAA;AAEY,QAAA,gBAAgB,GAAG,qBAAqB,CAAC;AACtD,IAAM,YAAY,GAAa;IAC7B,UAAU,EAAE;QACV,IAAI,EAAE,wBAAgB;QACtB,WAAW,EAAE,0BAA0B;QACvC,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sCAAsC;iBACpD;gBACD,eAAe,EAAE;oBACf,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,kDAAkD;iBAChE;aACF;YACD,QAAQ,EAAE,CAAC,YAAY,EAAE,iBAAiB,CAAC;SAC5C;KACF;IACD,IAAI,EAAE,UAAO,MAAuD;;oBAAK,qBAAM,cAAE,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,eAAe,CAAC,EAAA;oBAAxD,sBAAA,SAAwD,EAAA;;aAAA;IACjI,YAAY,EAAE;QACZ,+CAAwC,wBAAgB,cAAW;KACpE;CACF,CAAA;AAEY,QAAA,WAAW,GAAe;IACrC,oBAAoB;IACpB,qCAA6B;IAC7B,gCAAgC;IAChC,cAAc;IACd,YAAY;IACZ,YAAY;CACb,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ConversationModule, ConversationModuleFactory } from '../../ConversationModule';
|
|
2
|
+
import { Function } from '../../Function';
|
|
3
|
+
export declare class GitModule implements ConversationModule {
|
|
4
|
+
private repoPath;
|
|
5
|
+
constructor(repoPath: string);
|
|
6
|
+
getName(): string;
|
|
7
|
+
getSystemMessages(): string[];
|
|
8
|
+
getFunctions(): Function[];
|
|
9
|
+
getMessageModerators(): never[];
|
|
10
|
+
}
|
|
11
|
+
export declare class GitModuleFactory implements ConversationModuleFactory {
|
|
12
|
+
createModule(repoPath: string): Promise<GitModule>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=GitModule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitModule.d.ts","sourceRoot":"","sources":["../../../../src/fs/git/GitModule.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,qBAAa,SAAU,YAAW,kBAAkB;IAClD,OAAO,CAAC,QAAQ,CAAS;gBAEb,QAAQ,EAAE,MAAM;IAI5B,OAAO,IAAI,MAAM;IAIjB,iBAAiB,IAAI,MAAM,EAAE;IAQ7B,YAAY,IAAI,QAAQ,EAAE;IAM1B,oBAAoB;CAGrB;AAED,qBAAa,gBAAiB,YAAW,yBAAyB;IAC1D,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;CAGzD"}
|
|
@@ -8,38 +8,79 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
+
if (ar || !(i in from)) {
|
|
41
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
+
ar[i] = from[i];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
+
};
|
|
11
47
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
48
|
exports.GitModuleFactory = exports.GitModule = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
49
|
+
var util_node_1 = require("@proteinjs/util-node");
|
|
50
|
+
var GitModule = /** @class */ (function () {
|
|
51
|
+
function GitModule(repoPath) {
|
|
16
52
|
this.repoPath = repoPath;
|
|
17
53
|
}
|
|
18
|
-
getName() {
|
|
54
|
+
GitModule.prototype.getName = function () {
|
|
19
55
|
return 'Git';
|
|
20
|
-
}
|
|
21
|
-
getSystemMessages() {
|
|
22
|
-
return [
|
|
23
|
-
`After we make code changes (write to files), ask the user if they'd like to commit and sync those changes`,
|
|
24
|
-
`If they want to commit, offer them 3 generated messages that summarize the changes to choose from, as well as the option to write a custom message`,
|
|
25
|
-
`The generated messages should be 1-3 sentences in length, and each generated option should be a different length of summary`,
|
|
26
|
-
];
|
|
27
|
-
}
|
|
28
|
-
getFunctions() {
|
|
56
|
+
};
|
|
57
|
+
GitModule.prototype.getSystemMessages = function () {
|
|
29
58
|
return [
|
|
30
|
-
|
|
59
|
+
"After we make code changes (write to files), ask the user if they'd like to commit and sync those changes",
|
|
60
|
+
"If they want to commit, offer them 3 generated messages that summarize the changes to choose from, as well as the option to write a custom message",
|
|
61
|
+
"The generated messages should be 1-3 sentences in length, and each generated option should be a different length of summary",
|
|
31
62
|
];
|
|
32
|
-
}
|
|
33
|
-
|
|
63
|
+
};
|
|
64
|
+
GitModule.prototype.getFunctions = function () {
|
|
65
|
+
return __spreadArray([], util_node_1.gitFunctions, true);
|
|
66
|
+
};
|
|
67
|
+
GitModule.prototype.getMessageModerators = function () {
|
|
34
68
|
return [];
|
|
35
|
-
}
|
|
36
|
-
|
|
69
|
+
};
|
|
70
|
+
return GitModule;
|
|
71
|
+
}());
|
|
37
72
|
exports.GitModule = GitModule;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
41
|
-
return new GitModule(repoPath);
|
|
42
|
-
});
|
|
73
|
+
var GitModuleFactory = /** @class */ (function () {
|
|
74
|
+
function GitModuleFactory() {
|
|
43
75
|
}
|
|
44
|
-
|
|
76
|
+
GitModuleFactory.prototype.createModule = function (repoPath) {
|
|
77
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
78
|
+
return __generator(this, function (_a) {
|
|
79
|
+
return [2 /*return*/, new GitModule(repoPath)];
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
return GitModuleFactory;
|
|
84
|
+
}());
|
|
45
85
|
exports.GitModuleFactory = GitModuleFactory;
|
|
86
|
+
//# sourceMappingURL=GitModule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitModule.js","sourceRoot":"","sources":["../../../../src/fs/git/GitModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAoD;AAIpD;IAGE,mBAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,2BAAO,GAAP;QACE,OAAO,KAAK,CAAC;IACf,CAAC;IAED,qCAAiB,GAAjB;QACE,OAAO;YACL,2GAA2G;YAC3G,oJAAoJ;YACpJ,6HAA6H;SAC9H,CAAC;IACJ,CAAC;IAED,gCAAY,GAAZ;QACE,yBACK,wBAAY,QACf;IACJ,CAAC;IAED,wCAAoB,GAApB;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IACH,gBAAC;AAAD,CAAC,AA5BD,IA4BC;AA5BY,8BAAS;AA8BtB;IAAA;IAIA,CAAC;IAHO,uCAAY,GAAlB,UAAmB,QAAgB;;;gBACjC,sBAAO,IAAI,SAAS,CAAC,QAAQ,CAAC,EAAC;;;KAChC;IACH,uBAAC;AAAD,CAAC,AAJD,IAIC;AAJY,4CAAgB"}
|