@proteinjs/conversation 1.0.6 → 1.0.7

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.
Files changed (152) hide show
  1. package/.eslintrc.js +20 -0
  2. package/.prettierrc +8 -0
  3. package/CHANGELOG.md +7 -4
  4. package/LICENSE +21 -0
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +40 -28
  7. package/dist/src/CodegenConversation.d.ts +11 -11
  8. package/dist/src/CodegenConversation.d.ts.map +1 -1
  9. package/dist/src/CodegenConversation.js +294 -180
  10. package/dist/src/CodegenConversation.js.map +1 -1
  11. package/dist/src/Conversation.d.ts +52 -49
  12. package/dist/src/Conversation.d.ts.map +1 -1
  13. package/dist/src/Conversation.js +480 -274
  14. package/dist/src/Conversation.js.map +1 -1
  15. package/dist/src/ConversationModule.d.ts +6 -6
  16. package/dist/src/ConversationModule.js +3 -3
  17. package/dist/src/Function.d.ts +4 -4
  18. package/dist/src/Function.d.ts.map +1 -1
  19. package/dist/src/Function.js +3 -3
  20. package/dist/src/OpenAi.d.ts +42 -10
  21. package/dist/src/OpenAi.d.ts.map +1 -1
  22. package/dist/src/OpenAi.js +496 -289
  23. package/dist/src/OpenAi.js.map +1 -1
  24. package/dist/src/Paragraph.d.ts +4 -4
  25. package/dist/src/Paragraph.d.ts.map +1 -1
  26. package/dist/src/Paragraph.js +17 -16
  27. package/dist/src/Paragraph.js.map +1 -1
  28. package/dist/src/Sentence.d.ts +4 -4
  29. package/dist/src/Sentence.d.ts.map +1 -1
  30. package/dist/src/Sentence.js +21 -19
  31. package/dist/src/Sentence.js.map +1 -1
  32. package/dist/src/code_template/Code.d.ts +15 -15
  33. package/dist/src/code_template/Code.d.ts.map +1 -1
  34. package/dist/src/code_template/Code.js +167 -69
  35. package/dist/src/code_template/Code.js.map +1 -1
  36. package/dist/src/code_template/CodeTemplate.d.ts +11 -11
  37. package/dist/src/code_template/CodeTemplate.d.ts.map +1 -1
  38. package/dist/src/code_template/CodeTemplate.js +169 -79
  39. package/dist/src/code_template/CodeTemplate.js.map +1 -1
  40. package/dist/src/code_template/CodeTemplateModule.d.ts +6 -6
  41. package/dist/src/code_template/CodeTemplateModule.js +28 -26
  42. package/dist/src/code_template/Repo.d.ts +34 -38
  43. package/dist/src/code_template/Repo.d.ts.map +1 -1
  44. package/dist/src/code_template/Repo.js +291 -191
  45. package/dist/src/code_template/Repo.js.map +1 -1
  46. package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts +12 -12
  47. package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts.map +1 -1
  48. package/dist/src/fs/conversation_fs/ConversationFsModerator.js +111 -98
  49. package/dist/src/fs/conversation_fs/ConversationFsModerator.js.map +1 -1
  50. package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts +11 -11
  51. package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts.map +1 -1
  52. package/dist/src/fs/conversation_fs/ConversationFsModule.js +204 -99
  53. package/dist/src/fs/conversation_fs/ConversationFsModule.js.map +1 -1
  54. package/dist/src/fs/conversation_fs/FsFunctions.d.ts +58 -62
  55. package/dist/src/fs/conversation_fs/FsFunctions.d.ts.map +1 -1
  56. package/dist/src/fs/conversation_fs/FsFunctions.js +414 -266
  57. package/dist/src/fs/conversation_fs/FsFunctions.js.map +1 -1
  58. package/dist/src/fs/git/GitModule.d.ts +8 -8
  59. package/dist/src/fs/git/GitModule.d.ts.map +1 -1
  60. package/dist/src/fs/git/GitModule.js +163 -74
  61. package/dist/src/fs/git/GitModule.js.map +1 -1
  62. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts +16 -18
  63. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts.map +1 -1
  64. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js +158 -58
  65. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js.map +1 -1
  66. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts +27 -26
  67. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts.map +1 -1
  68. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js +234 -133
  69. package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js.map +1 -1
  70. package/dist/src/fs/package/PackageFunctions.d.ts +54 -60
  71. package/dist/src/fs/package/PackageFunctions.d.ts.map +1 -1
  72. package/dist/src/fs/package/PackageFunctions.js +366 -223
  73. package/dist/src/fs/package/PackageFunctions.js.map +1 -1
  74. package/dist/src/fs/package/PackageModule.d.ts +24 -24
  75. package/dist/src/fs/package/PackageModule.d.ts.map +1 -1
  76. package/dist/src/fs/package/PackageModule.js +292 -163
  77. package/dist/src/fs/package/PackageModule.js.map +1 -1
  78. package/dist/src/history/MessageHistory.d.ts +12 -12
  79. package/dist/src/history/MessageHistory.d.ts.map +1 -1
  80. package/dist/src/history/MessageHistory.js +52 -43
  81. package/dist/src/history/MessageHistory.js.map +1 -1
  82. package/dist/src/history/MessageModerator.d.ts +2 -2
  83. package/dist/src/history/MessageModerator.js +3 -3
  84. package/dist/src/template/ConversationTemplate.d.ts +8 -8
  85. package/dist/src/template/ConversationTemplate.d.ts.map +1 -1
  86. package/dist/src/template/ConversationTemplate.js +3 -3
  87. package/dist/src/template/ConversationTemplateFunctions.d.ts +33 -35
  88. package/dist/src/template/ConversationTemplateFunctions.d.ts.map +1 -1
  89. package/dist/src/template/ConversationTemplateFunctions.js +176 -75
  90. package/dist/src/template/ConversationTemplateFunctions.js.map +1 -1
  91. package/dist/src/template/ConversationTemplateModule.d.ts +51 -48
  92. package/dist/src/template/ConversationTemplateModule.d.ts.map +1 -1
  93. package/dist/src/template/ConversationTemplateModule.js +211 -114
  94. package/dist/src/template/ConversationTemplateModule.js.map +1 -1
  95. package/dist/src/template/createApp/CreateAppTemplate.d.ts +1 -1
  96. package/dist/src/template/createApp/CreateAppTemplate.js +151 -59
  97. package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts +1 -1
  98. package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts.map +1 -1
  99. package/dist/src/template/createCode/CreateCodeConversationTemplate.js +183 -74
  100. package/dist/src/template/createCode/CreateCodeConversationTemplate.js.map +1 -1
  101. package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts +1 -1
  102. package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts.map +1 -1
  103. package/dist/src/template/createPackage/CreatePackageConversationTemplate.js +174 -84
  104. package/dist/src/template/createPackage/CreatePackageConversationTemplate.js.map +1 -1
  105. package/dist/src/template/createPackage/tsconfig.json +11 -11
  106. package/dist/test/createKeywordFilesIndex.test.d.ts +1 -1
  107. package/dist/test/createKeywordFilesIndex.test.js +132 -41
  108. package/dist/test/createKeywordFilesIndex.test.js.map +1 -1
  109. package/dist/test/openai/openai.generateList.test.d.ts +1 -1
  110. package/dist/test/openai/openai.generateList.test.js +136 -47
  111. package/dist/test/openai/openai.generateList.test.js.map +1 -1
  112. package/dist/test/openai/openai.parseCodeFromMarkdown.test.d.ts +1 -1
  113. package/dist/test/openai/openai.parseCodeFromMarkdown.test.js +15 -10
  114. package/dist/test/openai/openai.parseCodeFromMarkdown.test.js.map +1 -1
  115. package/dist/test/repo/repo.test.d.ts +1 -1
  116. package/dist/test/repo/repo.test.js +127 -38
  117. package/dist/test/repo/repo.test.js.map +1 -1
  118. package/jest.config.js +2 -2
  119. package/package.json +9 -3
  120. package/src/CodegenConversation.ts +6 -4
  121. package/src/Conversation.ts +102 -33
  122. package/src/ConversationModule.ts +2 -2
  123. package/src/Function.ts +0 -1
  124. package/src/OpenAi.ts +128 -63
  125. package/src/Paragraph.ts +3 -2
  126. package/src/Sentence.ts +5 -3
  127. package/src/code_template/Code.ts +25 -19
  128. package/src/code_template/CodeTemplate.ts +8 -7
  129. package/src/code_template/CodeTemplateModule.ts +2 -2
  130. package/src/code_template/Repo.ts +25 -19
  131. package/src/fs/conversation_fs/ConversationFsModerator.ts +34 -20
  132. package/src/fs/conversation_fs/ConversationFsModule.ts +13 -7
  133. package/src/fs/conversation_fs/FsFunctions.ts +33 -44
  134. package/src/fs/git/GitModule.ts +2 -4
  135. package/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.ts +31 -31
  136. package/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.ts +19 -18
  137. package/src/fs/package/PackageFunctions.ts +34 -41
  138. package/src/fs/package/PackageModule.ts +33 -21
  139. package/src/history/MessageHistory.ts +7 -4
  140. package/src/history/MessageModerator.ts +1 -1
  141. package/src/template/ConversationTemplate.ts +9 -9
  142. package/src/template/ConversationTemplateFunctions.ts +8 -7
  143. package/src/template/ConversationTemplateModule.ts +24 -15
  144. package/src/template/createApp/CreateAppTemplate.ts +1 -1
  145. package/src/template/createCode/CreateCodeConversationTemplate.ts +9 -11
  146. package/src/template/createPackage/CreatePackageConversationTemplate.ts +2 -9
  147. package/src/template/createPackage/jest.config.js +2 -2
  148. package/test/createKeywordFilesIndex.test.ts +3 -3
  149. package/test/openai/openai.generateList.test.ts +5 -3
  150. package/test/openai/openai.parseCodeFromMarkdown.test.ts +10 -5
  151. package/test/repo/repo.test.ts +3 -4
  152. package/tsconfig.json +16 -20
@@ -1,87 +1,177 @@
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); }); }
1
+ 'use strict';
2
+ var __awaiter =
3
+ (this && this.__awaiter) ||
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
+ }
4
12
  return new (P || (P = Promise))(function (resolve, reject) {
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());
13
+ function fulfilled(value) {
14
+ try {
15
+ step(generator.next(value));
16
+ } catch (e) {
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());
9
31
  });
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]); }; }
32
+ };
33
+ var __generator =
34
+ (this && this.__generator) ||
35
+ function (thisArg, body) {
36
+ var _ = {
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
+ }
15
62
  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 };
63
+ if (f) throw new TypeError('Generator is already executing.');
64
+ while ((g && ((g = 0), op[0] && (_ = 0)), _))
65
+ try {
66
+ if (
67
+ ((f = 1),
68
+ y &&
69
+ (t = op[0] & 2 ? y['return'] : op[0] ? y['throw'] || ((t = y['return']) && t.call(y), 0) : y.next) &&
70
+ !(t = t.call(y, op[1])).done)
71
+ )
72
+ return t;
73
+ if (((y = 0), t)) op = [op[0] & 2, t.value];
74
+ switch (op[0]) {
75
+ case 0:
76
+ case 1:
77
+ t = op;
78
+ break;
79
+ case 4:
80
+ _.label++;
81
+ return { value: op[1], done: false };
82
+ case 5:
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 };
36
123
  }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
124
+ };
125
+ Object.defineProperty(exports, '__esModule', { value: true });
39
126
  exports.CodeTemplate = void 0;
40
- var util_1 = require("@proteinjs/util");
41
- var util_node_1 = require("@proteinjs/util-node");
127
+ var util_1 = require('@proteinjs/util');
128
+ var util_node_1 = require('@proteinjs/util-node');
42
129
  var CodeTemplate = /** @class */ (function () {
43
- function CodeTemplate(templateArgs) {
44
- this.logger = new util_1.Logger(this.constructor.name);
45
- this.templateArgs = templateArgs;
130
+ function CodeTemplate(templateArgs) {
131
+ this.logger = new util_1.Logger(this.constructor.name);
132
+ this.templateArgs = templateArgs;
133
+ }
134
+ CodeTemplate.prototype.generate = function () {
135
+ return __awaiter(this, void 0, void 0, function () {
136
+ var _i, _a, sourceFile, filePath, code;
137
+ return __generator(this, function (_b) {
138
+ switch (_b.label) {
139
+ case 0:
140
+ return [4 /*yield*/, util_node_1.PackageUtil.installPackages(this.resolvePackages())];
141
+ case 1:
142
+ _b.sent();
143
+ (_i = 0), (_a = this.sourceFiles());
144
+ _b.label = 2;
145
+ case 2:
146
+ if (!(_i < _a.length)) return [3 /*break*/, 6];
147
+ sourceFile = _a[_i];
148
+ filePath = util_node_1.Fs.baseContainedJoin(this.templateArgs.srcPath, sourceFile.relativePath);
149
+ this.logger.info('Generating source file: '.concat(filePath));
150
+ return [4 /*yield*/, sourceFile.code.generate()];
151
+ case 3:
152
+ code = _b.sent();
153
+ return [4 /*yield*/, util_node_1.Fs.writeFiles([{ path: filePath, content: code }])];
154
+ case 4:
155
+ _b.sent();
156
+ this.logger.info('Generated source file: '.concat(filePath));
157
+ _b.label = 5;
158
+ case 5:
159
+ _i++;
160
+ return [3 /*break*/, 2];
161
+ case 6:
162
+ return [2 /*return*/];
163
+ }
164
+ });
165
+ });
166
+ };
167
+ CodeTemplate.prototype.resolvePackages = function () {
168
+ var packages = this.templateArgs.replacePackages ? [] : this.dependencyPackages();
169
+ if (this.templateArgs.additionalPackages) {
170
+ packages.push.apply(packages, this.templateArgs.additionalPackages);
46
171
  }
47
- CodeTemplate.prototype.generate = function () {
48
- return __awaiter(this, void 0, void 0, function () {
49
- var _i, _a, sourceFile, filePath, code;
50
- return __generator(this, function (_b) {
51
- switch (_b.label) {
52
- case 0: return [4 /*yield*/, util_node_1.PackageUtil.installPackages(this.resolvePackages())];
53
- case 1:
54
- _b.sent();
55
- _i = 0, _a = this.sourceFiles();
56
- _b.label = 2;
57
- case 2:
58
- if (!(_i < _a.length)) return [3 /*break*/, 6];
59
- sourceFile = _a[_i];
60
- filePath = util_node_1.Fs.baseContainedJoin(this.templateArgs.srcPath, sourceFile.relativePath);
61
- this.logger.info("Generating source file: ".concat(filePath));
62
- return [4 /*yield*/, sourceFile.code.generate()];
63
- case 3:
64
- code = _b.sent();
65
- return [4 /*yield*/, util_node_1.Fs.writeFiles([{ path: filePath, content: code }])];
66
- case 4:
67
- _b.sent();
68
- this.logger.info("Generated source file: ".concat(filePath));
69
- _b.label = 5;
70
- case 5:
71
- _i++;
72
- return [3 /*break*/, 2];
73
- case 6: return [2 /*return*/];
74
- }
75
- });
76
- });
77
- };
78
- CodeTemplate.prototype.resolvePackages = function () {
79
- var packages = this.templateArgs.replacePackages ? [] : this.dependencyPackages();
80
- if (this.templateArgs.additionalPackages)
81
- packages.push.apply(packages, this.templateArgs.additionalPackages);
82
- return packages;
83
- };
84
- return CodeTemplate;
85
- }());
172
+ return packages;
173
+ };
174
+ return CodeTemplate;
175
+ })();
86
176
  exports.CodeTemplate = CodeTemplate;
87
- //# sourceMappingURL=CodeTemplate.js.map
177
+ //# sourceMappingURL=CodeTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeTemplate.js","sourceRoot":"","sources":["../../../src/code_template/CodeTemplate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAyC;AACzC,kDAAgE;AAShE;IAIE,sBAAY,YAA0B;QAH5B,WAAM,GAAG,IAAI,aAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAInD,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;IACnC,CAAC;IAKK,+BAAQ,GAAd;;;;;4BACE,qBAAM,uBAAW,CAAC,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,EAAA;;wBAAzD,SAAyD,CAAC;8BACjB,EAAlB,KAAA,IAAI,CAAC,WAAW,EAAE;;;6BAAlB,CAAA,cAAkB,CAAA;wBAAhC,UAAU;wBACX,QAAQ,GAAG,cAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;wBAC1F,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAA2B,QAAQ,CAAE,CAAC,CAAC;wBAC3C,qBAAM,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAA;;wBAAvC,IAAI,GAAG,SAAgC;wBAC7C,qBAAM,cAAE,CAAC,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAA;;wBAAxD,SAAwD,CAAC;wBACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iCAA0B,QAAQ,CAAE,CAAC,CAAC;;;wBALlC,IAAkB,CAAA;;;;;;KAO1C;IAEO,sCAAe,GAAvB;QACE,IAAM,QAAQ,GAAc,IAAI,CAAC,YAAY,CAAC,eAAe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,SAAwD,CAAC;wBACzD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iCAA0B,QAAQ,CAAE,CAAC,CAAC;;;wBALhC,IAAkB,CAAA;;;;;;KAO5C;IAEO,sCAAe,GAAvB;QACE,IAAM,QAAQ,GAAc,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC/F,IAAI,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE;YACxC,QAAQ,CAAC,IAAI,OAAb,QAAQ,EAAS,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE;SACxD;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IACH,mBAAC;AAAD,CAAC,AA7BD,IA6BC;AA7BqB,oCAAY"}
@@ -2,10 +2,10 @@ import { ConversationModule } from '../ConversationModule';
2
2
  import { Function } from '../Function';
3
3
  import { MessageModerator } from '../history/MessageModerator';
4
4
  export declare class CodeTemplateModule implements ConversationModule {
5
- private static CODE_RESPONSE;
6
- getName(): string;
7
- getSystemMessages(): string[];
8
- getFunctions(): Function[];
9
- getMessageModerators(): MessageModerator[];
5
+ private static CODE_RESPONSE;
6
+ getName(): string;
7
+ getSystemMessages(): string[];
8
+ getFunctions(): Function[];
9
+ getMessageModerators(): MessageModerator[];
10
10
  }
11
- //# sourceMappingURL=CodeTemplateModule.d.ts.map
11
+ //# sourceMappingURL=CodeTemplateModule.d.ts.map
@@ -1,30 +1,32 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
3
  exports.CodeTemplateModule = void 0;
4
4
  var CodeTemplateModule = /** @class */ (function () {
5
- function CodeTemplateModule() {
6
- }
7
- CodeTemplateModule.prototype.getName = function () {
8
- return 'Code Template';
9
- };
10
- CodeTemplateModule.prototype.getSystemMessages = function () {
11
- return [
12
- "If they want to create a function/class/object using an API we are familiar with, we will ask the user for the required information to fill in all mandatory parameters and ask them if they want to provide optional parameter values",
13
- "Once we have gotten the values for all parameters, respond with '".concat(CodeTemplateModule.CODE_RESPONSE, "' followed by the code to instantiate/call the function/class/object with the user's responses for parameter values"),
14
- "If you're generating a call to a class that extends Template, require that the user provide Template's constructor parameters as well and combine them into the parameters passed into the base class you're instantiating",
15
- "Make sure you ask for a srcPath and pass that in to the Template base class constructor arg",
16
- "Surround generated code (not including imports) with a self-executing, anonymous async function like this (async function() =>{})()",
17
- ];
18
- };
19
- CodeTemplateModule.prototype.getFunctions = function () {
20
- return [];
21
- };
22
- CodeTemplateModule.prototype.getMessageModerators = function () {
23
- return [];
24
- };
25
- CodeTemplateModule.CODE_RESPONSE = 'Code with user input:';
26
- return CodeTemplateModule;
27
- }());
5
+ function CodeTemplateModule() {}
6
+ CodeTemplateModule.prototype.getName = function () {
7
+ return 'Code Template';
8
+ };
9
+ CodeTemplateModule.prototype.getSystemMessages = function () {
10
+ return [
11
+ 'If they want to create a function/class/object using an API we are familiar with, we will ask the user for the required information to fill in all mandatory parameters and ask them if they want to provide optional parameter values',
12
+ "Once we have gotten the values for all parameters, respond with '".concat(
13
+ CodeTemplateModule.CODE_RESPONSE,
14
+ "' followed by the code to instantiate/call the function/class/object with the user's responses for parameter values"
15
+ ),
16
+ "If you're generating a call to a class that extends Template, require that the user provide Template's constructor parameters as well and combine them into the parameters passed into the base class you're instantiating",
17
+ 'Make sure you ask for a srcPath and pass that in to the Template base class constructor arg',
18
+ 'Surround generated code (not including imports) with a self-executing, anonymous async function like this (async function() =>{})()',
19
+ ];
20
+ };
21
+ CodeTemplateModule.prototype.getFunctions = function () {
22
+ return [];
23
+ };
24
+ CodeTemplateModule.prototype.getMessageModerators = function () {
25
+ return [];
26
+ };
27
+ CodeTemplateModule.CODE_RESPONSE = 'Code with user input:';
28
+ return CodeTemplateModule;
29
+ })();
28
30
  exports.CodeTemplateModule = CodeTemplateModule;
29
31
  // if (response.includes(CodegenConversation.CODE_RESPONSE))
30
32
  // await this.generateCode(response, conversation);
@@ -47,4 +49,4 @@ exports.CodeTemplateModule = CodeTemplateModule;
47
49
  // console.info(`Ran command: ${commandLog}`);
48
50
  // console.info(`Generated code from template: ${codePath}`);
49
51
  // }
50
- //# sourceMappingURL=CodeTemplateModule.js.map
52
+ //# sourceMappingURL=CodeTemplateModule.js.map
@@ -1,50 +1,46 @@
1
1
  import { FileDescriptor } from '@proteinjs/util-node';
2
2
  export interface TsFile extends FileDescriptor {
3
- declaration: string;
3
+ declaration: string;
4
4
  }
5
5
  export interface PackageInfo {
6
- packageJSON: any;
7
- dirPath: string;
8
- tsFiles: {
9
- [tsFilePath: string]: TsFile;
10
- };
11
- fileDescriptors: FileDescriptor[];
6
+ packageJSON: any;
7
+ dirPath: string;
8
+ tsFiles: {
9
+ [tsFilePath: string]: TsFile;
10
+ };
11
+ fileDescriptors: FileDescriptor[];
12
12
  }
13
13
  export type SlimPackageInfo = Omit<PackageInfo, 'packageJSON' | 'tsFiles'>;
14
14
  export type RepoParams = {
15
- packages: Record<string, PackageInfo>;
16
- slimPackages: Record<string, SlimPackageInfo>;
17
- tsFiles: {
18
- [tsFilePath: string]: TsFile;
19
- };
20
- keywordFilesIndex: {
21
- [keyword: string]: string[]; /** file paths */
22
- };
15
+ packages: Record<string, PackageInfo>;
16
+ slimPackages: Record<string, SlimPackageInfo>;
17
+ tsFiles: {
18
+ [tsFilePath: string]: TsFile;
19
+ };
20
+ keywordFilesIndex: {
21
+ [keyword: string]: string[] /** file paths */;
22
+ };
23
23
  };
24
24
  export declare class Repo {
25
- private logger;
26
- params: RepoParams;
27
- constructor(params: RepoParams);
28
- packages(): Record<string, PackageInfo>;
29
- slimPackages(): Record<string, SlimPackageInfo>;
30
- tsFiles(): {
31
- [tsFilePath: string]: TsFile;
32
- };
33
- keywordFilesIndex(): {
34
- [keyword: string]: string[];
35
- };
36
- searchFiles(params: {
37
- keyword: string;
38
- }): string[];
39
- getDeclarations(params: {
40
- tsFilePaths: string[];
41
- }): {
42
- [tsFilePath: string]: string;
43
- };
25
+ private logger;
26
+ params: RepoParams;
27
+ constructor(params: RepoParams);
28
+ packages(): Record<string, PackageInfo>;
29
+ slimPackages(): Record<string, SlimPackageInfo>;
30
+ tsFiles(): {
31
+ [tsFilePath: string]: TsFile;
32
+ };
33
+ keywordFilesIndex(): {
34
+ [keyword: string]: string[];
35
+ };
36
+ searchFiles(params: { keyword: string }): string[];
37
+ getDeclarations(params: { tsFilePaths: string[] }): {
38
+ [tsFilePath: string]: string;
39
+ };
44
40
  }
45
41
  export declare class RepoFactory {
46
- private static LOGGER;
47
- static createRepo(dir: string): Promise<Repo>;
48
- private static loadFiles;
42
+ private static LOGGER;
43
+ static createRepo(dir: string): Promise<Repo>;
44
+ private static loadFiles;
49
45
  }
50
- //# sourceMappingURL=Repo.d.ts.map
46
+ //# sourceMappingURL=Repo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Repo.d.ts","sourceRoot":"","sources":["../../../src/code_template/Repo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAmB,MAAM,sBAAsB,CAAC;AAIvE,MAAM,WAAW,MAAO,SAAQ,cAAc;IAC5C,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,GAAG,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QAAE,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC1C,eAAe,EAAE,cAAc,EAAE,CAAC;CACnC;AAED,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,GAAC,SAAS,CAAC,CAAC;AAEzE,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACtC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC9C,OAAO,EA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