@proteinjs/conversation 1.0.7 → 1.0.9
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/.eslintrc.js +1 -1
- package/.prettierignore +4 -0
- package/CHANGELOG.md +11 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -40
- package/dist/src/CodegenConversation.d.ts +11 -11
- package/dist/src/CodegenConversation.js +180 -294
- package/dist/src/Conversation.d.ts +49 -52
- package/dist/src/Conversation.js +288 -478
- package/dist/src/ConversationModule.d.ts +6 -6
- package/dist/src/ConversationModule.js +3 -3
- package/dist/src/Function.d.ts +4 -4
- package/dist/src/Function.js +3 -3
- package/dist/src/OpenAi.d.ts +10 -42
- package/dist/src/OpenAi.js +305 -495
- package/dist/src/Paragraph.d.ts +4 -4
- package/dist/src/Paragraph.js +17 -17
- package/dist/src/Sentence.d.ts +4 -4
- package/dist/src/Sentence.js +21 -21
- package/dist/src/code_template/Code.d.ts +15 -15
- package/dist/src/code_template/Code.js +73 -167
- package/dist/src/code_template/CodeTemplate.d.ts +11 -11
- package/dist/src/code_template/CodeTemplate.js +80 -169
- package/dist/src/code_template/CodeTemplateModule.d.ts +6 -6
- package/dist/src/code_template/CodeTemplateModule.js +26 -28
- package/dist/src/code_template/Repo.d.ts +38 -34
- package/dist/src/code_template/Repo.js +195 -291
- package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts +12 -12
- package/dist/src/fs/conversation_fs/ConversationFsModerator.js +108 -110
- package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts +11 -11
- package/dist/src/fs/conversation_fs/ConversationFsModule.js +97 -204
- package/dist/src/fs/conversation_fs/FsFunctions.d.ts +62 -58
- package/dist/src/fs/conversation_fs/FsFunctions.js +252 -414
- package/dist/src/fs/git/GitModule.d.ts +8 -8
- package/dist/src/fs/git/GitModule.js +74 -163
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts +18 -16
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js +58 -158
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts +26 -27
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js +131 -234
- package/dist/src/fs/package/PackageFunctions.d.ts +60 -54
- package/dist/src/fs/package/PackageFunctions.js +213 -366
- package/dist/src/fs/package/PackageModule.d.ts +24 -24
- package/dist/src/fs/package/PackageModule.js +170 -292
- package/dist/src/history/MessageHistory.d.ts +12 -12
- package/dist/src/history/MessageHistory.js +46 -52
- package/dist/src/history/MessageModerator.d.ts +2 -2
- package/dist/src/history/MessageModerator.js +3 -3
- package/dist/src/template/ConversationTemplate.d.ts +8 -8
- package/dist/src/template/ConversationTemplate.js +3 -3
- package/dist/src/template/ConversationTemplateFunctions.d.ts +35 -33
- package/dist/src/template/ConversationTemplateFunctions.js +75 -176
- package/dist/src/template/ConversationTemplateModule.d.ts +48 -51
- package/dist/src/template/ConversationTemplateModule.js +116 -211
- package/dist/src/template/createApp/CreateAppTemplate.d.ts +1 -1
- package/dist/src/template/createApp/CreateAppTemplate.js +59 -151
- package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts +1 -1
- package/dist/src/template/createCode/CreateCodeConversationTemplate.js +67 -183
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts +1 -1
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.js +77 -174
- package/dist/src/template/createPackage/tsconfig.json +11 -11
- package/dist/test/createKeywordFilesIndex.test.d.ts +1 -1
- package/dist/test/createKeywordFilesIndex.test.js +41 -132
- package/dist/test/openai/openai.generateList.test.d.ts +1 -1
- package/dist/test/openai/openai.generateList.test.js +47 -136
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.d.ts +1 -1
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.js +12 -13
- package/dist/test/repo/repo.test.d.ts +1 -1
- package/dist/test/repo/repo.test.js +38 -127
- package/package.json +5 -6
- package/LICENSE +0 -21
|
@@ -1,479 +1,317 @@
|
|
|
1
|
-
|
|
2
|
-
var __awaiter =
|
|
3
|
-
|
|
4
|
-
function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) {
|
|
6
|
-
return value instanceof P
|
|
7
|
-
? value
|
|
8
|
-
: new P(function (resolve) {
|
|
9
|
-
resolve(value);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
12
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
reject(e);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function rejected(value) {
|
|
21
|
-
try {
|
|
22
|
-
step(generator['throw'](value));
|
|
23
|
-
} catch (e) {
|
|
24
|
-
reject(e);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
function step(result) {
|
|
28
|
-
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
29
|
-
}
|
|
30
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
31
9
|
});
|
|
32
|
-
|
|
33
|
-
var __generator =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
label: 0,
|
|
38
|
-
sent: function () {
|
|
39
|
-
if (t[0] & 1) throw t[1];
|
|
40
|
-
return t[1];
|
|
41
|
-
},
|
|
42
|
-
trys: [],
|
|
43
|
-
ops: [],
|
|
44
|
-
},
|
|
45
|
-
f,
|
|
46
|
-
y,
|
|
47
|
-
t,
|
|
48
|
-
g;
|
|
49
|
-
return (
|
|
50
|
-
(g = { next: verb(0), throw: verb(1), return: verb(2) }),
|
|
51
|
-
typeof Symbol === 'function' &&
|
|
52
|
-
(g[Symbol.iterator] = function () {
|
|
53
|
-
return this;
|
|
54
|
-
}),
|
|
55
|
-
g
|
|
56
|
-
);
|
|
57
|
-
function verb(n) {
|
|
58
|
-
return function (v) {
|
|
59
|
-
return step([n, v]);
|
|
60
|
-
};
|
|
61
|
-
}
|
|
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]); }; }
|
|
62
15
|
function step(op) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
(
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
_.label++;
|
|
84
|
-
y = op[1];
|
|
85
|
-
op = [0];
|
|
86
|
-
continue;
|
|
87
|
-
case 7:
|
|
88
|
-
op = _.ops.pop();
|
|
89
|
-
_.trys.pop();
|
|
90
|
-
continue;
|
|
91
|
-
default:
|
|
92
|
-
if (!((t = _.trys), (t = t.length > 0 && t[t.length - 1])) && (op[0] === 6 || op[0] === 2)) {
|
|
93
|
-
_ = 0;
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
|
|
97
|
-
_.label = op[1];
|
|
98
|
-
break;
|
|
99
|
-
}
|
|
100
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
101
|
-
_.label = t[1];
|
|
102
|
-
t = op;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
if (t && _.label < t[2]) {
|
|
106
|
-
_.label = t[2];
|
|
107
|
-
_.ops.push(op);
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
if (t[2]) _.ops.pop();
|
|
111
|
-
_.trys.pop();
|
|
112
|
-
continue;
|
|
113
|
-
}
|
|
114
|
-
op = body.call(thisArg, _);
|
|
115
|
-
} catch (e) {
|
|
116
|
-
op = [6, e];
|
|
117
|
-
y = 0;
|
|
118
|
-
} finally {
|
|
119
|
-
f = t = 0;
|
|
120
|
-
}
|
|
121
|
-
if (op[0] & 5) throw op[1];
|
|
122
|
-
return { value: op[0] ? op[1] : void 0, done: true };
|
|
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 };
|
|
123
36
|
}
|
|
124
|
-
|
|
125
|
-
Object.defineProperty(exports,
|
|
126
|
-
exports.fsFunctions =
|
|
127
|
-
|
|
128
|
-
exports.copyFunctionName =
|
|
129
|
-
exports.renameFunctionName =
|
|
130
|
-
exports.getFilePathsMatchingGlobFunctionName =
|
|
131
|
-
exports.fileOrDirectoryExistsFunction =
|
|
132
|
-
exports.fileOrDirectoryExistsFunctionName =
|
|
133
|
-
exports.getRecentlyAccessedFilePathsFunction =
|
|
134
|
-
exports.getRecentlyAccessedFilePathsFunctionName =
|
|
135
|
-
exports.writeFilesFunction =
|
|
136
|
-
exports.writeFilesFunctionName =
|
|
137
|
-
exports.readFilesFunction =
|
|
138
|
-
exports.readFilesFunctionName =
|
|
139
|
-
void 0;
|
|
140
|
-
var util_node_1 = require('@proteinjs/util-node');
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
40
|
+
var util_node_1 = require("@proteinjs/util-node");
|
|
141
41
|
exports.readFilesFunctionName = 'readFiles';
|
|
142
42
|
function readFilesFunction(fsModule) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
43
|
+
var _this = this;
|
|
44
|
+
return {
|
|
45
|
+
definition: {
|
|
46
|
+
name: exports.readFilesFunctionName,
|
|
47
|
+
description: 'Get the content of files',
|
|
48
|
+
parameters: {
|
|
49
|
+
type: 'object',
|
|
50
|
+
properties: {
|
|
51
|
+
filePaths: {
|
|
52
|
+
type: 'array',
|
|
53
|
+
description: 'Paths to the files',
|
|
54
|
+
items: {
|
|
55
|
+
type: 'string',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
required: ['filePaths'],
|
|
156
60
|
},
|
|
157
|
-
},
|
|
158
61
|
},
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
});
|
|
174
|
-
},
|
|
175
|
-
instructions: [
|
|
176
|
-
'To read files from the local file system, use the '.concat(exports.readFilesFunctionName, ' function'),
|
|
177
|
-
],
|
|
178
|
-
};
|
|
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
|
+
}); },
|
|
72
|
+
instructions: ["To read files from the local file system, use the ".concat(exports.readFilesFunctionName, " function")],
|
|
73
|
+
};
|
|
179
74
|
}
|
|
180
75
|
exports.readFilesFunction = readFilesFunction;
|
|
181
76
|
exports.writeFilesFunctionName = 'writeFiles';
|
|
182
77
|
function writeFilesFunction(fsModule) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
78
|
+
var _this = this;
|
|
79
|
+
return {
|
|
80
|
+
definition: {
|
|
81
|
+
name: exports.writeFilesFunctionName,
|
|
82
|
+
description: 'Write files to the file system',
|
|
83
|
+
parameters: {
|
|
84
|
+
type: 'object',
|
|
85
|
+
properties: {
|
|
86
|
+
files: {
|
|
87
|
+
type: 'array',
|
|
88
|
+
description: 'Files to write',
|
|
89
|
+
items: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
properties: {
|
|
92
|
+
path: {
|
|
93
|
+
type: 'string',
|
|
94
|
+
description: 'the file path',
|
|
95
|
+
},
|
|
96
|
+
content: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
description: 'the content to write to the file',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
200
103
|
},
|
|
201
|
-
|
|
202
|
-
type: 'string',
|
|
203
|
-
description: 'the content to write to the file',
|
|
204
|
-
},
|
|
205
|
-
},
|
|
104
|
+
required: ['files'],
|
|
206
105
|
},
|
|
207
|
-
},
|
|
208
106
|
},
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
);
|
|
222
|
-
return [4 /*yield*/, util_node_1.Fs.writeFiles(params.files)];
|
|
223
|
-
case 1:
|
|
224
|
-
return [2 /*return*/, _a.sent()];
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
|
-
});
|
|
228
|
-
},
|
|
229
|
-
instructions: [
|
|
230
|
-
'To write files to the local file system, use the '.concat(exports.writeFilesFunctionName, ' function'),
|
|
231
|
-
],
|
|
232
|
-
};
|
|
107
|
+
call: function (params) { return __awaiter(_this, void 0, void 0, function () {
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
switch (_a.label) {
|
|
110
|
+
case 0:
|
|
111
|
+
fsModule.pushRecentlyAccessedFilePath(params.files.map(function (file) { return file.path; }));
|
|
112
|
+
return [4 /*yield*/, util_node_1.Fs.writeFiles(params.files)];
|
|
113
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}); },
|
|
117
|
+
instructions: ["To write files to the local file system, use the ".concat(exports.writeFilesFunctionName, " function")],
|
|
118
|
+
};
|
|
233
119
|
}
|
|
234
120
|
exports.writeFilesFunction = writeFilesFunction;
|
|
235
121
|
exports.getRecentlyAccessedFilePathsFunctionName = 'getRecentlyAccessedFilePaths';
|
|
236
122
|
function getRecentlyAccessedFilePathsFunction(fsModule) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
},
|
|
255
|
-
};
|
|
123
|
+
var _this = this;
|
|
124
|
+
return {
|
|
125
|
+
definition: {
|
|
126
|
+
name: exports.getRecentlyAccessedFilePathsFunctionName,
|
|
127
|
+
description: 'Get paths of files accessed during this conversation, in order from oldest to newest',
|
|
128
|
+
parameters: {
|
|
129
|
+
type: 'object',
|
|
130
|
+
properties: {},
|
|
131
|
+
required: [],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
call: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
135
|
+
return [2 /*return*/, fsModule.getRecentlyAccessedFilePaths()];
|
|
136
|
+
}); }); },
|
|
137
|
+
};
|
|
256
138
|
}
|
|
257
139
|
exports.getRecentlyAccessedFilePathsFunction = getRecentlyAccessedFilePathsFunction;
|
|
258
140
|
var createFolderFunctionName = 'createFolder';
|
|
259
141
|
var createFolderFunction = {
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
142
|
+
definition: {
|
|
143
|
+
name: createFolderFunctionName,
|
|
144
|
+
description: 'Create a folder/directory',
|
|
145
|
+
parameters: {
|
|
146
|
+
type: 'object',
|
|
147
|
+
properties: {
|
|
148
|
+
path: {
|
|
149
|
+
type: 'string',
|
|
150
|
+
description: 'Path of the new directory',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
required: ['path'],
|
|
269
154
|
},
|
|
270
|
-
},
|
|
271
|
-
required: ['path'],
|
|
272
155
|
},
|
|
273
|
-
|
|
274
|
-
call: function (params) {
|
|
275
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
276
|
-
return __generator(this, function (_a) {
|
|
156
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
277
157
|
switch (_a.label) {
|
|
278
|
-
|
|
279
|
-
return [
|
|
280
|
-
case 1:
|
|
281
|
-
return [2 /*return*/, _a.sent()];
|
|
158
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.createFolder(params.path)];
|
|
159
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
282
160
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
},
|
|
286
|
-
instructions: ['To create a folder on the local file system, use the '.concat(createFolderFunctionName, ' function')],
|
|
161
|
+
}); }); },
|
|
162
|
+
instructions: ["To create a folder on the local file system, use the ".concat(createFolderFunctionName, " function")],
|
|
287
163
|
};
|
|
288
164
|
exports.fileOrDirectoryExistsFunctionName = 'fileOrDirectoryExists';
|
|
289
165
|
exports.fileOrDirectoryExistsFunction = {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
166
|
+
definition: {
|
|
167
|
+
name: exports.fileOrDirectoryExistsFunctionName,
|
|
168
|
+
description: 'Check if a file or directory exists',
|
|
169
|
+
parameters: {
|
|
170
|
+
type: 'object',
|
|
171
|
+
properties: {
|
|
172
|
+
path: {
|
|
173
|
+
type: 'string',
|
|
174
|
+
description: 'Path of the file or directory',
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
required: ['path'],
|
|
299
178
|
},
|
|
300
|
-
},
|
|
301
|
-
required: ['path'],
|
|
302
179
|
},
|
|
303
|
-
|
|
304
|
-
call: function (params) {
|
|
305
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
306
|
-
return __generator(this, function (_a) {
|
|
180
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
307
181
|
switch (_a.label) {
|
|
308
|
-
|
|
309
|
-
return [
|
|
310
|
-
case 1:
|
|
311
|
-
return [2 /*return*/, _a.sent()];
|
|
182
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.exists(params.path)];
|
|
183
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
312
184
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
'To check if a file or folder exists on the local file system, use the '.concat(
|
|
318
|
-
exports.fileOrDirectoryExistsFunctionName,
|
|
319
|
-
' function'
|
|
320
|
-
),
|
|
321
|
-
],
|
|
185
|
+
}); }); },
|
|
186
|
+
instructions: [
|
|
187
|
+
"To check if a file or folder exists on the local file system, use the ".concat(exports.fileOrDirectoryExistsFunctionName, " function"),
|
|
188
|
+
],
|
|
322
189
|
};
|
|
323
190
|
exports.getFilePathsMatchingGlobFunctionName = 'getFilePathsMatchingGlob';
|
|
324
191
|
var getFilePathsMatchingGlobFunction = {
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
192
|
+
definition: {
|
|
193
|
+
name: exports.getFilePathsMatchingGlobFunctionName,
|
|
194
|
+
description: 'Get file paths matching a glob',
|
|
195
|
+
parameters: {
|
|
196
|
+
type: 'object',
|
|
197
|
+
properties: {
|
|
198
|
+
dirPrefix: {
|
|
199
|
+
type: 'string',
|
|
200
|
+
description: 'Directory to recursively search for files',
|
|
201
|
+
},
|
|
202
|
+
glob: {
|
|
203
|
+
type: 'string',
|
|
204
|
+
description: 'File matching pattern',
|
|
205
|
+
},
|
|
206
|
+
globIgnorePatterns: {
|
|
207
|
+
type: 'array',
|
|
208
|
+
description: 'Directories to ignore',
|
|
209
|
+
items: {
|
|
210
|
+
type: 'string',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
required: ['dirPrefix', 'glob'],
|
|
345
215
|
},
|
|
346
|
-
},
|
|
347
|
-
required: ['dirPrefix', 'glob'],
|
|
348
216
|
},
|
|
349
|
-
|
|
350
|
-
call: function (params) {
|
|
351
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
352
|
-
return __generator(this, function (_a) {
|
|
217
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
353
218
|
switch (_a.label) {
|
|
354
|
-
|
|
355
|
-
return [
|
|
356
|
-
4 /*yield*/,
|
|
357
|
-
util_node_1.Fs.getFilePathsMatchingGlob(params.dirPrefix, params.glob, params.globIgnorePatterns),
|
|
358
|
-
];
|
|
359
|
-
case 1:
|
|
360
|
-
return [2 /*return*/, _a.sent()];
|
|
219
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.getFilePathsMatchingGlob(params.dirPrefix, params.glob, params.globIgnorePatterns)];
|
|
220
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
361
221
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
},
|
|
365
|
-
instructions: [
|
|
366
|
-
'To get file paths matching a glob, use the '.concat(exports.getFilePathsMatchingGlobFunctionName, ' function'),
|
|
367
|
-
],
|
|
222
|
+
}); }); },
|
|
223
|
+
instructions: ["To get file paths matching a glob, use the ".concat(exports.getFilePathsMatchingGlobFunctionName, " function")],
|
|
368
224
|
};
|
|
369
225
|
exports.renameFunctionName = 'renameFileOrDirectory';
|
|
370
226
|
var renameFunction = {
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
227
|
+
definition: {
|
|
228
|
+
name: exports.renameFunctionName,
|
|
229
|
+
description: 'Rename a file or directory',
|
|
230
|
+
parameters: {
|
|
231
|
+
type: 'object',
|
|
232
|
+
properties: {
|
|
233
|
+
oldPath: {
|
|
234
|
+
type: 'string',
|
|
235
|
+
description: 'Original path of the file or directory',
|
|
236
|
+
},
|
|
237
|
+
newName: {
|
|
238
|
+
type: 'string',
|
|
239
|
+
description: 'New name for the file or directory',
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
required: ['oldPath', 'newName'],
|
|
384
243
|
},
|
|
385
|
-
},
|
|
386
|
-
required: ['oldPath', 'newName'],
|
|
387
244
|
},
|
|
388
|
-
|
|
389
|
-
call: function (params) {
|
|
390
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
391
|
-
return __generator(this, function (_a) {
|
|
245
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
392
246
|
switch (_a.label) {
|
|
393
|
-
|
|
394
|
-
return [
|
|
395
|
-
case 1:
|
|
396
|
-
return [2 /*return*/, _a.sent()];
|
|
247
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.rename(params.oldPath, params.newName)];
|
|
248
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
397
249
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
},
|
|
401
|
-
instructions: ['To rename a file or directory, use the '.concat(exports.renameFunctionName, ' function')],
|
|
250
|
+
}); }); },
|
|
251
|
+
instructions: ["To rename a file or directory, use the ".concat(exports.renameFunctionName, " function")],
|
|
402
252
|
};
|
|
403
253
|
exports.copyFunctionName = 'copyFileOrDirectory';
|
|
404
254
|
var copyFunction = {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
255
|
+
definition: {
|
|
256
|
+
name: exports.copyFunctionName,
|
|
257
|
+
description: 'Copy a file or directory',
|
|
258
|
+
parameters: {
|
|
259
|
+
type: 'object',
|
|
260
|
+
properties: {
|
|
261
|
+
sourcePath: {
|
|
262
|
+
type: 'string',
|
|
263
|
+
description: 'Path of the source file or directory',
|
|
264
|
+
},
|
|
265
|
+
destinationPath: {
|
|
266
|
+
type: 'string',
|
|
267
|
+
description: 'Destination path for the copied file or directory',
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
required: ['sourcePath', 'destinationPath'],
|
|
418
271
|
},
|
|
419
|
-
},
|
|
420
|
-
required: ['sourcePath', 'destinationPath'],
|
|
421
272
|
},
|
|
422
|
-
|
|
423
|
-
call: function (params) {
|
|
424
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
425
|
-
return __generator(this, function (_a) {
|
|
273
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
426
274
|
switch (_a.label) {
|
|
427
|
-
|
|
428
|
-
return [
|
|
429
|
-
case 1:
|
|
430
|
-
return [2 /*return*/, _a.sent()];
|
|
275
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.copy(params.sourcePath, params.destinationPath)];
|
|
276
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
431
277
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
},
|
|
435
|
-
instructions: ['To copy a file or directory, use the '.concat(exports.copyFunctionName, ' function')],
|
|
278
|
+
}); }); },
|
|
279
|
+
instructions: ["To copy a file or directory, use the ".concat(exports.copyFunctionName, " function")],
|
|
436
280
|
};
|
|
437
281
|
exports.moveFunctionName = 'moveFileOrDirectory';
|
|
438
282
|
var moveFunction = {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
283
|
+
definition: {
|
|
284
|
+
name: exports.moveFunctionName,
|
|
285
|
+
description: 'Move a file or directory',
|
|
286
|
+
parameters: {
|
|
287
|
+
type: 'object',
|
|
288
|
+
properties: {
|
|
289
|
+
sourcePath: {
|
|
290
|
+
type: 'string',
|
|
291
|
+
description: 'Path of the source file or directory',
|
|
292
|
+
},
|
|
293
|
+
destinationPath: {
|
|
294
|
+
type: 'string',
|
|
295
|
+
description: 'Destination path for the moved file or directory',
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
required: ['sourcePath', 'destinationPath'],
|
|
452
299
|
},
|
|
453
|
-
},
|
|
454
|
-
required: ['sourcePath', 'destinationPath'],
|
|
455
300
|
},
|
|
456
|
-
|
|
457
|
-
call: function (params) {
|
|
458
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
459
|
-
return __generator(this, function (_a) {
|
|
301
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
460
302
|
switch (_a.label) {
|
|
461
|
-
|
|
462
|
-
return [
|
|
463
|
-
case 1:
|
|
464
|
-
return [2 /*return*/, _a.sent()];
|
|
303
|
+
case 0: return [4 /*yield*/, util_node_1.Fs.move(params.sourcePath, params.destinationPath)];
|
|
304
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
465
305
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
},
|
|
469
|
-
instructions: ['To move a file or directory, use the '.concat(exports.moveFunctionName, ' function')],
|
|
306
|
+
}); }); },
|
|
307
|
+
instructions: ["To move a file or directory, use the ".concat(exports.moveFunctionName, " function")],
|
|
470
308
|
};
|
|
471
309
|
exports.fsFunctions = [
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
310
|
+
createFolderFunction,
|
|
311
|
+
exports.fileOrDirectoryExistsFunction,
|
|
312
|
+
getFilePathsMatchingGlobFunction,
|
|
313
|
+
renameFunction,
|
|
314
|
+
copyFunction,
|
|
315
|
+
moveFunction,
|
|
478
316
|
];
|
|
479
|
-
//# sourceMappingURL=FsFunctions.js.map
|
|
317
|
+
//# sourceMappingURL=FsFunctions.js.map
|