@proteinjs/conversation 1.0.5 → 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.
- package/.eslintrc.js +20 -0
- package/.prettierrc +8 -0
- package/CHANGELOG.md +7 -4
- package/LICENSE +21 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +40 -28
- package/dist/src/CodegenConversation.d.ts +11 -11
- package/dist/src/CodegenConversation.d.ts.map +1 -1
- package/dist/src/CodegenConversation.js +294 -180
- package/dist/src/CodegenConversation.js.map +1 -1
- package/dist/src/Conversation.d.ts +52 -49
- package/dist/src/Conversation.d.ts.map +1 -1
- package/dist/src/Conversation.js +480 -274
- package/dist/src/Conversation.js.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/src/Function.js +3 -3
- package/dist/src/OpenAi.d.ts +42 -10
- package/dist/src/OpenAi.d.ts.map +1 -1
- package/dist/src/OpenAi.js +496 -289
- package/dist/src/OpenAi.js.map +1 -1
- package/dist/src/Paragraph.d.ts +4 -4
- package/dist/src/Paragraph.d.ts.map +1 -1
- package/dist/src/Paragraph.js +17 -16
- package/dist/src/Paragraph.js.map +1 -1
- package/dist/src/Sentence.d.ts +4 -4
- package/dist/src/Sentence.d.ts.map +1 -1
- package/dist/src/Sentence.js +21 -19
- package/dist/src/Sentence.js.map +1 -1
- package/dist/src/code_template/Code.d.ts +15 -15
- package/dist/src/code_template/Code.d.ts.map +1 -1
- package/dist/src/code_template/Code.js +167 -69
- package/dist/src/code_template/Code.js.map +1 -1
- package/dist/src/code_template/CodeTemplate.d.ts +11 -11
- package/dist/src/code_template/CodeTemplate.d.ts.map +1 -1
- package/dist/src/code_template/CodeTemplate.js +169 -79
- package/dist/src/code_template/CodeTemplate.js.map +1 -1
- package/dist/src/code_template/CodeTemplateModule.d.ts +6 -6
- package/dist/src/code_template/CodeTemplateModule.js +28 -26
- package/dist/src/code_template/Repo.d.ts +34 -38
- package/dist/src/code_template/Repo.d.ts.map +1 -1
- package/dist/src/code_template/Repo.js +291 -191
- package/dist/src/code_template/Repo.js.map +1 -1
- package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts +12 -12
- package/dist/src/fs/conversation_fs/ConversationFsModerator.d.ts.map +1 -1
- package/dist/src/fs/conversation_fs/ConversationFsModerator.js +111 -98
- package/dist/src/fs/conversation_fs/ConversationFsModerator.js.map +1 -1
- package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts +11 -11
- package/dist/src/fs/conversation_fs/ConversationFsModule.d.ts.map +1 -1
- package/dist/src/fs/conversation_fs/ConversationFsModule.js +204 -99
- package/dist/src/fs/conversation_fs/ConversationFsModule.js.map +1 -1
- package/dist/src/fs/conversation_fs/FsFunctions.d.ts +58 -62
- package/dist/src/fs/conversation_fs/FsFunctions.d.ts.map +1 -1
- package/dist/src/fs/conversation_fs/FsFunctions.js +414 -266
- package/dist/src/fs/conversation_fs/FsFunctions.js.map +1 -1
- package/dist/src/fs/git/GitModule.d.ts +8 -8
- package/dist/src/fs/git/GitModule.d.ts.map +1 -1
- package/dist/src/fs/git/GitModule.js +163 -74
- package/dist/src/fs/git/GitModule.js.map +1 -1
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts +16 -18
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.d.ts.map +1 -1
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js +158 -58
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.js.map +1 -1
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts +27 -26
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.d.ts.map +1 -1
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js +234 -133
- package/dist/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.js.map +1 -1
- package/dist/src/fs/package/PackageFunctions.d.ts +54 -60
- package/dist/src/fs/package/PackageFunctions.d.ts.map +1 -1
- package/dist/src/fs/package/PackageFunctions.js +366 -223
- package/dist/src/fs/package/PackageFunctions.js.map +1 -1
- package/dist/src/fs/package/PackageModule.d.ts +24 -24
- package/dist/src/fs/package/PackageModule.d.ts.map +1 -1
- package/dist/src/fs/package/PackageModule.js +292 -163
- package/dist/src/fs/package/PackageModule.js.map +1 -1
- package/dist/src/history/MessageHistory.d.ts +12 -12
- package/dist/src/history/MessageHistory.d.ts.map +1 -1
- package/dist/src/history/MessageHistory.js +52 -43
- package/dist/src/history/MessageHistory.js.map +1 -1
- 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.d.ts.map +1 -1
- package/dist/src/template/ConversationTemplate.js +3 -3
- package/dist/src/template/ConversationTemplateFunctions.d.ts +33 -35
- package/dist/src/template/ConversationTemplateFunctions.d.ts.map +1 -1
- package/dist/src/template/ConversationTemplateFunctions.js +176 -75
- package/dist/src/template/ConversationTemplateFunctions.js.map +1 -1
- package/dist/src/template/ConversationTemplateModule.d.ts +51 -48
- package/dist/src/template/ConversationTemplateModule.d.ts.map +1 -1
- package/dist/src/template/ConversationTemplateModule.js +211 -114
- package/dist/src/template/ConversationTemplateModule.js.map +1 -1
- package/dist/src/template/createApp/CreateAppTemplate.d.ts +1 -1
- package/dist/src/template/createApp/CreateAppTemplate.js +151 -59
- package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts +1 -1
- package/dist/src/template/createCode/CreateCodeConversationTemplate.d.ts.map +1 -1
- package/dist/src/template/createCode/CreateCodeConversationTemplate.js +183 -74
- package/dist/src/template/createCode/CreateCodeConversationTemplate.js.map +1 -1
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts +1 -1
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.d.ts.map +1 -1
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.js +174 -84
- package/dist/src/template/createPackage/CreatePackageConversationTemplate.js.map +1 -1
- package/dist/src/template/createPackage/tsconfig.json +11 -11
- package/dist/test/createKeywordFilesIndex.test.d.ts +1 -1
- package/dist/test/createKeywordFilesIndex.test.js +132 -41
- package/dist/test/createKeywordFilesIndex.test.js.map +1 -1
- package/dist/test/openai/openai.generateList.test.d.ts +1 -1
- package/dist/test/openai/openai.generateList.test.js +136 -47
- package/dist/test/openai/openai.generateList.test.js.map +1 -1
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.d.ts +1 -1
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.js +15 -10
- package/dist/test/openai/openai.parseCodeFromMarkdown.test.js.map +1 -1
- package/dist/test/repo/repo.test.d.ts +1 -1
- package/dist/test/repo/repo.test.js +127 -38
- package/dist/test/repo/repo.test.js.map +1 -1
- package/jest.config.js +2 -2
- package/package.json +11 -5
- package/src/CodegenConversation.ts +6 -4
- package/src/Conversation.ts +102 -33
- package/src/ConversationModule.ts +2 -2
- package/src/Function.ts +0 -1
- package/src/OpenAi.ts +128 -63
- package/src/Paragraph.ts +3 -2
- package/src/Sentence.ts +5 -3
- package/src/code_template/Code.ts +25 -19
- package/src/code_template/CodeTemplate.ts +8 -7
- package/src/code_template/CodeTemplateModule.ts +2 -2
- package/src/code_template/Repo.ts +25 -19
- package/src/fs/conversation_fs/ConversationFsModerator.ts +34 -20
- package/src/fs/conversation_fs/ConversationFsModule.ts +13 -7
- package/src/fs/conversation_fs/FsFunctions.ts +33 -44
- package/src/fs/git/GitModule.ts +2 -4
- package/src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.ts +31 -31
- package/src/fs/keyword_to_files_index/KeywordToFilesIndexModule.ts +19 -18
- package/src/fs/package/PackageFunctions.ts +34 -41
- package/src/fs/package/PackageModule.ts +33 -21
- package/src/history/MessageHistory.ts +7 -4
- package/src/history/MessageModerator.ts +1 -1
- package/src/template/ConversationTemplate.ts +9 -9
- package/src/template/ConversationTemplateFunctions.ts +8 -7
- package/src/template/ConversationTemplateModule.ts +24 -15
- package/src/template/createApp/CreateAppTemplate.ts +1 -1
- package/src/template/createCode/CreateCodeConversationTemplate.ts +9 -11
- package/src/template/createPackage/CreatePackageConversationTemplate.ts +2 -9
- package/src/template/createPackage/jest.config.js +2 -2
- package/test/createKeywordFilesIndex.test.ts +3 -3
- package/test/openai/openai.generateList.test.ts +5 -3
- package/test/openai/openai.parseCodeFromMarkdown.test.ts +10 -5
- package/test/repo/repo.test.ts +3 -4
- package/tsconfig.json +16 -20
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
import { ConversationModule, ConversationModuleFactory } from '../../ConversationModule';
|
|
2
2
|
import { Function } from '../../Function';
|
|
3
3
|
export type KeywordToFilesIndexModuleParams = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
dir: string;
|
|
5
|
+
keywordFilesIndex: {
|
|
6
|
+
[keyword: string]: string[] /** file paths */;
|
|
7
|
+
};
|
|
8
8
|
};
|
|
9
9
|
export declare class KeywordToFilesIndexModule implements ConversationModule {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
getFunctions(): Function[];
|
|
19
|
-
getMessageModerators(): never[];
|
|
10
|
+
private logger;
|
|
11
|
+
params: KeywordToFilesIndexModuleParams;
|
|
12
|
+
constructor(params: KeywordToFilesIndexModuleParams);
|
|
13
|
+
getName(): string;
|
|
14
|
+
searchFiles(params: { keyword: string }): string[];
|
|
15
|
+
getSystemMessages(): string[];
|
|
16
|
+
getFunctions(): Function[];
|
|
17
|
+
getMessageModerators(): never[];
|
|
20
18
|
}
|
|
21
19
|
export declare class KeywordToFilesIndexModuleFactory implements ConversationModuleFactory {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
private logger;
|
|
21
|
+
createModule(repoPath: string): Promise<KeywordToFilesIndexModule>;
|
|
22
|
+
/**
|
|
23
|
+
* Create keyword-files index for the given base directory.
|
|
24
|
+
*
|
|
25
|
+
* @param baseDir - The directory to start the file search from.
|
|
26
|
+
* @returns An index with keywords mapped to file paths.
|
|
27
|
+
*/
|
|
28
|
+
createKeywordFilesIndex(
|
|
29
|
+
baseDir: string,
|
|
30
|
+
globIgnorePatterns?: string[]
|
|
31
|
+
): Promise<{
|
|
32
|
+
[keyword: string]: string[];
|
|
33
|
+
}>;
|
|
33
34
|
}
|
|
34
|
-
//# sourceMappingURL=KeywordToFilesIndexModule.d.ts.map
|
|
35
|
+
//# sourceMappingURL=KeywordToFilesIndexModule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeywordToFilesIndexModule.d.ts","sourceRoot":"","sources":["../../../../src/fs/keyword_to_files_index/KeywordToFilesIndexModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,MAAM,MAAM,+BAA+B,GAAG;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA,CAAC,iBAAiB;KAAE,CAAC;CACtE,
|
|
1
|
+
{"version":3,"file":"KeywordToFilesIndexModule.d.ts","sourceRoot":"","sources":["../../../../src/fs/keyword_to_files_index/KeywordToFilesIndexModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAI1C,MAAM,MAAM,+BAA+B,GAAG;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ,iBAAiB,EAAE;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA,CAAC,iBAAiB;KAAE,CAAC;CACtE,CAAC;AAEF,qBAAa,yBAA0B,YAAW,kBAAkB;IAClE,OAAO,CAAC,MAAM,CAAqC;IACnD,MAAM,EAAE,+BAA+B,CAAC;gBAE5B,MAAM,EAAE,+BAA+B;IAInD,OAAO,IAAI,MAAM;IAIjB,WAAW,CAAC,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;IAMvC,iBAAiB,IAAI,MAAM,EAAE;IAM7B,YAAY,IAAI,QAAQ,EAAE;IAI1B,oBAAoB;CAGrB;AAED,qBAAa,gCAAiC,YAAW,yBAAyB;IAChF,OAAO,CAAC,MAAM,CAAqC;IAE7C,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAQxE;;;;;OAKG;IACG,uBAAuB,CAC3B,OAAO,EAAE,MAAM,EACf,kBAAkB,GAAE,MAAM,EAAO,GAChC,OAAO,CAAC;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;CAyB5C"}
|
|
@@ -1,146 +1,247 @@
|
|
|
1
|
-
|
|
2
|
-
var __awaiter =
|
|
3
|
-
|
|
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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
var __spreadArray =
|
|
39
|
-
|
|
124
|
+
};
|
|
125
|
+
var __spreadArray =
|
|
126
|
+
(this && this.__spreadArray) ||
|
|
127
|
+
function (to, from, pack) {
|
|
128
|
+
if (pack || arguments.length === 2)
|
|
129
|
+
for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
130
|
if (ar || !(i in from)) {
|
|
41
|
-
|
|
42
|
-
|
|
131
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
132
|
+
ar[i] = from[i];
|
|
43
133
|
}
|
|
44
|
-
|
|
134
|
+
}
|
|
45
135
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
-
};
|
|
47
|
-
var __importDefault =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
136
|
+
};
|
|
137
|
+
var __importDefault =
|
|
138
|
+
(this && this.__importDefault) ||
|
|
139
|
+
function (mod) {
|
|
140
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
141
|
+
};
|
|
142
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
51
143
|
exports.KeywordToFilesIndexModuleFactory = exports.KeywordToFilesIndexModule = void 0;
|
|
52
|
-
var util_1 = require(
|
|
53
|
-
var util_node_1 = require(
|
|
54
|
-
var path_1 = __importDefault(require(
|
|
55
|
-
var KeywordToFilesIndexFunctions_1 = require(
|
|
144
|
+
var util_1 = require('@proteinjs/util');
|
|
145
|
+
var util_node_1 = require('@proteinjs/util-node');
|
|
146
|
+
var path_1 = __importDefault(require('path'));
|
|
147
|
+
var KeywordToFilesIndexFunctions_1 = require('./KeywordToFilesIndexFunctions');
|
|
56
148
|
var KeywordToFilesIndexModule = /** @class */ (function () {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
149
|
+
function KeywordToFilesIndexModule(params) {
|
|
150
|
+
this.logger = new util_1.Logger(this.constructor.name);
|
|
151
|
+
this.params = params;
|
|
152
|
+
}
|
|
153
|
+
KeywordToFilesIndexModule.prototype.getName = function () {
|
|
154
|
+
return 'Keyword to files index';
|
|
155
|
+
};
|
|
156
|
+
KeywordToFilesIndexModule.prototype.searchFiles = function (params) {
|
|
157
|
+
this.logger.info('Searching for file, keyword: '.concat(params.keyword));
|
|
158
|
+
var filePaths = this.params.keywordFilesIndex[params.keyword];
|
|
159
|
+
return filePaths || [];
|
|
160
|
+
};
|
|
161
|
+
KeywordToFilesIndexModule.prototype.getSystemMessages = function () {
|
|
162
|
+
return [
|
|
163
|
+
"If you're searching for something, use the ".concat(
|
|
164
|
+
KeywordToFilesIndexFunctions_1.searchFilesFunctionName,
|
|
165
|
+
' function to find a file matching the search string'
|
|
166
|
+
),
|
|
167
|
+
];
|
|
168
|
+
};
|
|
169
|
+
KeywordToFilesIndexModule.prototype.getFunctions = function () {
|
|
170
|
+
return [(0, KeywordToFilesIndexFunctions_1.searchFilesFunction)(this)];
|
|
171
|
+
};
|
|
172
|
+
KeywordToFilesIndexModule.prototype.getMessageModerators = function () {
|
|
173
|
+
return [];
|
|
174
|
+
};
|
|
175
|
+
return KeywordToFilesIndexModule;
|
|
176
|
+
})();
|
|
84
177
|
exports.KeywordToFilesIndexModule = KeywordToFilesIndexModule;
|
|
85
178
|
var KeywordToFilesIndexModuleFactory = /** @class */ (function () {
|
|
86
|
-
|
|
87
|
-
|
|
179
|
+
function KeywordToFilesIndexModuleFactory() {
|
|
180
|
+
this.logger = new util_1.Logger(this.constructor.name);
|
|
181
|
+
}
|
|
182
|
+
KeywordToFilesIndexModuleFactory.prototype.createModule = function (repoPath) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
184
|
+
var repoParams, _a;
|
|
185
|
+
return __generator(this, function (_b) {
|
|
186
|
+
switch (_b.label) {
|
|
187
|
+
case 0:
|
|
188
|
+
this.logger.debug('Creating module for repo: '.concat(repoPath));
|
|
189
|
+
repoParams = { keywordFilesIndex: {}, dir: repoPath };
|
|
190
|
+
_a = repoParams;
|
|
191
|
+
return [4 /*yield*/, this.createKeywordFilesIndex(repoPath, ['**/node-typescript-parser/**'])];
|
|
192
|
+
case 1:
|
|
193
|
+
_a.keywordFilesIndex = _b.sent();
|
|
194
|
+
this.logger.debug('Created module for repo: '.concat(repoPath));
|
|
195
|
+
return [2 /*return*/, new KeywordToFilesIndexModule(repoParams)];
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
/**
|
|
201
|
+
* Create keyword-files index for the given base directory.
|
|
202
|
+
*
|
|
203
|
+
* @param baseDir - The directory to start the file search from.
|
|
204
|
+
* @returns An index with keywords mapped to file paths.
|
|
205
|
+
*/
|
|
206
|
+
KeywordToFilesIndexModuleFactory.prototype.createKeywordFilesIndex = function (baseDir, globIgnorePatterns) {
|
|
207
|
+
if (globIgnorePatterns === void 0) {
|
|
208
|
+
globIgnorePatterns = [];
|
|
88
209
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
case 1:
|
|
126
|
-
filePaths = _a.sent();
|
|
127
|
-
keywordFilesIndex = {};
|
|
128
|
-
// Process each file path
|
|
129
|
-
for (_i = 0, filePaths_1 = filePaths; _i < filePaths_1.length; _i++) {
|
|
130
|
-
filePath = filePaths_1[_i];
|
|
131
|
-
fileName = path_1.default.parse(filePath).name;
|
|
132
|
-
if (!keywordFilesIndex[fileName]) {
|
|
133
|
-
keywordFilesIndex[fileName] = [];
|
|
134
|
-
}
|
|
135
|
-
this.logger.debug("fileName: ".concat(fileName, ", filePath: ").concat(filePath));
|
|
136
|
-
keywordFilesIndex[fileName].push(filePath);
|
|
137
|
-
}
|
|
138
|
-
return [2 /*return*/, keywordFilesIndex];
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
return KeywordToFilesIndexModuleFactory;
|
|
144
|
-
}());
|
|
210
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
211
|
+
var filePaths, keywordFilesIndex, _i, filePaths_1, filePath, fileName;
|
|
212
|
+
return __generator(this, function (_a) {
|
|
213
|
+
switch (_a.label) {
|
|
214
|
+
case 0:
|
|
215
|
+
// Ensure the base directory has a trailing slash
|
|
216
|
+
if (!baseDir.endsWith(path_1.default.sep)) {
|
|
217
|
+
baseDir += path_1.default.sep;
|
|
218
|
+
}
|
|
219
|
+
return [
|
|
220
|
+
4 /*yield*/,
|
|
221
|
+
util_node_1.Fs.getFilePaths(
|
|
222
|
+
baseDir,
|
|
223
|
+
__spreadArray(['**/node_modules/**', '**/dist/**'], globIgnorePatterns, true)
|
|
224
|
+
),
|
|
225
|
+
];
|
|
226
|
+
case 1:
|
|
227
|
+
filePaths = _a.sent();
|
|
228
|
+
keywordFilesIndex = {};
|
|
229
|
+
// Process each file path
|
|
230
|
+
for (_i = 0, filePaths_1 = filePaths; _i < filePaths_1.length; _i++) {
|
|
231
|
+
filePath = filePaths_1[_i];
|
|
232
|
+
fileName = path_1.default.parse(filePath).name;
|
|
233
|
+
if (!keywordFilesIndex[fileName]) {
|
|
234
|
+
keywordFilesIndex[fileName] = [];
|
|
235
|
+
}
|
|
236
|
+
this.logger.debug('fileName: '.concat(fileName, ', filePath: ').concat(filePath));
|
|
237
|
+
keywordFilesIndex[fileName].push(filePath);
|
|
238
|
+
}
|
|
239
|
+
return [2 /*return*/, keywordFilesIndex];
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
};
|
|
244
|
+
return KeywordToFilesIndexModuleFactory;
|
|
245
|
+
})();
|
|
145
246
|
exports.KeywordToFilesIndexModuleFactory = KeywordToFilesIndexModuleFactory;
|
|
146
|
-
//# sourceMappingURL=KeywordToFilesIndexModule.js.map
|
|
247
|
+
//# sourceMappingURL=KeywordToFilesIndexModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeywordToFilesIndexModule.js","sourceRoot":"","sources":["../../../../src/fs/keyword_to_files_index/KeywordToFilesIndexModule.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAyC;AACzC,kDAA0C;AAG1C,8CAAwB;AACxB,+EAA8F;AAO9F;IAIE,mCAAY,MAAuC;QAH3C,WAAM,GAAG,IAAI,aAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;QAIjD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,2CAAO,GAAP;QACE,OAAO,wBAAwB,CAAC;IAClC,CAAC;IAED,+CAAW,GAAX,UAAY,MAA2B;QACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,uCAAgC,MAAM,CAAC,OAAO,CAAE,CAAC,CAAC;QACnE,IAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAChE,OAAO,SAAS,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,qDAAiB,GAAjB;QACE,OAAO;YACL,qDAA8C,sDAAuB,wDAAqD;SAC3H,CAAC;IACJ,CAAC;IAED,gDAAY,GAAZ;QACE,OAAO
|
|
1
|
+
{"version":3,"file":"KeywordToFilesIndexModule.js","sourceRoot":"","sources":["../../../../src/fs/keyword_to_files_index/KeywordToFilesIndexModule.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,79 +1,73 @@
|
|
|
1
1
|
import { Function } from '../../Function';
|
|
2
2
|
import { PackageModule } from './PackageModule';
|
|
3
|
-
export declare const installPackagesFunctionName =
|
|
3
|
+
export declare const installPackagesFunctionName = 'installPackages';
|
|
4
4
|
export declare const installPackagesFunction: Function;
|
|
5
|
-
export declare const runPackageScriptFunctionName =
|
|
6
|
-
export declare const searchPackagesFunctionName =
|
|
5
|
+
export declare const runPackageScriptFunctionName = 'runPackageScript';
|
|
6
|
+
export declare const searchPackagesFunctionName = 'searchPackages';
|
|
7
7
|
export declare function searchPackagesFunction(packageModule: PackageModule): {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
required: string[];
|
|
8
|
+
definition: {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
parameters: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties: {
|
|
14
|
+
keyword: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
20
17
|
};
|
|
18
|
+
};
|
|
19
|
+
required: string[];
|
|
21
20
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
instructions: string[];
|
|
21
|
+
};
|
|
22
|
+
call: (params: { keyword: string }) => Promise<string[]>;
|
|
23
|
+
instructions: string[];
|
|
26
24
|
};
|
|
27
|
-
export declare const searchLibrariesFunctionName =
|
|
25
|
+
export declare const searchLibrariesFunctionName = 'searchLibraries';
|
|
28
26
|
export declare function searchLibrariesFunction(packageModule: PackageModule): {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
required: string[];
|
|
27
|
+
definition: {
|
|
28
|
+
name: string;
|
|
29
|
+
description: string;
|
|
30
|
+
parameters: {
|
|
31
|
+
type: string;
|
|
32
|
+
properties: {
|
|
33
|
+
keyword: {
|
|
34
|
+
type: string;
|
|
35
|
+
description: string;
|
|
41
36
|
};
|
|
37
|
+
};
|
|
38
|
+
required: string[];
|
|
42
39
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
instructions: string[];
|
|
40
|
+
};
|
|
41
|
+
call: (params: { keyword: string }) => Promise<import('./PackageModule').Library[]>;
|
|
42
|
+
instructions: string[];
|
|
47
43
|
};
|
|
48
|
-
export declare const generateTypescriptDeclarationsFunctionName =
|
|
44
|
+
export declare const generateTypescriptDeclarationsFunctionName = 'generateTypescriptDesclarations';
|
|
49
45
|
export declare const generateTypescriptDeclarationsFunction: {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
46
|
+
definition: {
|
|
47
|
+
name: string;
|
|
48
|
+
description: string;
|
|
49
|
+
parameters: {
|
|
50
|
+
type: string;
|
|
51
|
+
properties: {
|
|
52
|
+
tsFilePaths: {
|
|
53
|
+
type: string;
|
|
54
|
+
description: string;
|
|
55
|
+
items: {
|
|
54
56
|
type: string;
|
|
55
|
-
|
|
56
|
-
tsFilePaths: {
|
|
57
|
-
type: string;
|
|
58
|
-
description: string;
|
|
59
|
-
items: {
|
|
60
|
-
type: string;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
required: string[];
|
|
57
|
+
};
|
|
65
58
|
};
|
|
59
|
+
};
|
|
60
|
+
required: string[];
|
|
66
61
|
};
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
instructions: string[];
|
|
62
|
+
};
|
|
63
|
+
call: (params: { tsFilePaths: string[] }) => Promise<{
|
|
64
|
+
[tsFilePath: string]: string;
|
|
65
|
+
}>;
|
|
66
|
+
instructions: string[];
|
|
73
67
|
};
|
|
74
|
-
export declare const npmInstallFunctionName =
|
|
68
|
+
export declare const npmInstallFunctionName = 'npmInstall';
|
|
75
69
|
export declare const npmInstallFunction: Function;
|
|
76
|
-
export declare const uninstallPackagesFunctionName =
|
|
70
|
+
export declare const uninstallPackagesFunctionName = 'uninstallPackages';
|
|
77
71
|
export declare const uninstallPackagesFunction: Function;
|
|
78
72
|
export declare const packageFunctions: Function[];
|
|
79
|
-
//# sourceMappingURL=PackageFunctions.d.ts.map
|
|
73
|
+
//# sourceMappingURL=PackageFunctions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PackageFunctions.d.ts","sourceRoot":"","sources":["../../../../src/fs/package/PackageFunctions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAC7D,eAAO,MAAM,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"PackageFunctions.d.ts","sourceRoot":"","sources":["../../../../src/fs/package/PackageFunctions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAC7D,eAAO,MAAM,uBAAuB,EAAE,QA4CrC,CAAC;AAEF,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AA2B/D,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,aAAa;;;;;;;;;;;;;;;mBAgB1C;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;;EAG3C;AAED,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAC7D,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,aAAa;;;;;;;;;;;;;;;mBAgB3C;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;;EAG3C;AAED,eAAO,MAAM,0CAA0C,oCAAoC,CAAC;AAC5F,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;mBAkB5B;QAAE,WAAW,EAAE,MAAM,EAAE,CAAA;KAAE;;;;CAI/C,CAAC;AAEF,eAAO,MAAM,sBAAsB,eAAe,CAAC;AACnD,eAAO,MAAM,kBAAkB,EAAE,QAiBhC,CAAC;AAEF,eAAO,MAAM,6BAA6B,sBAAsB,CAAC;AACjE,eAAO,MAAM,yBAAyB,EAAE,QA0BvC,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,QAAQ,EAMtC,CAAC"}
|