@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
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { KeywordToFilesIndexModule } from './KeywordToFilesIndexModule';
|
|
2
|
+
export declare const searchFilesFunctionName = "searchFiles";
|
|
3
|
+
export declare const searchFilesFunction: (module: KeywordToFilesIndexModule) => {
|
|
4
|
+
definition: {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
parameters: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties: {
|
|
10
|
+
keyword: {
|
|
11
|
+
type: string;
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
required: string[];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
call: (params: {
|
|
19
|
+
keyword: string;
|
|
20
|
+
}) => Promise<string[]>;
|
|
21
|
+
instructions: string[];
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=KeywordToFilesIndexFunctions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeywordToFilesIndexFunctions.d.ts","sourceRoot":"","sources":["../../../../src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAEvE,eAAO,MAAM,uBAAuB,gBAAgB,CAAC;AACrD,eAAO,MAAM,mBAAmB,WAAY,yBAAyB;;;;;;;;;;;;;;;mBAgB5C;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;;CAO3C,CAAA"}
|
|
@@ -8,10 +8,37 @@ 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.searchFilesFunction = exports.searchFilesFunctionName = void 0;
|
|
13
40
|
exports.searchFilesFunctionName = 'searchFiles';
|
|
14
|
-
|
|
41
|
+
var searchFilesFunction = function (module) {
|
|
15
42
|
return {
|
|
16
43
|
definition: {
|
|
17
44
|
name: exports.searchFilesFunctionName,
|
|
@@ -27,11 +54,13 @@ const searchFilesFunction = (module) => {
|
|
|
27
54
|
required: ['keyword']
|
|
28
55
|
},
|
|
29
56
|
},
|
|
30
|
-
call: (params)
|
|
57
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
58
|
+
return [2 /*return*/, module.searchFiles(params)];
|
|
59
|
+
}); }); },
|
|
31
60
|
instructions: [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
61
|
+
"If the user is trying to interact with a file, but does not provide a path, you can find file paths that match a keyword using the ".concat(exports.searchFilesFunctionName, " function"),
|
|
62
|
+
"Only call functions that take in filePaths with valid file paths, if you don't know the valid file path try and search for it by keyword with the ".concat(exports.searchFilesFunctionName, " function"),
|
|
63
|
+
"If the user references a file in a package without providing a path, use the ".concat(exports.searchFilesFunctionName, " function on the keyword to find potentially relevant files, and choose the one that references the package name in its path"),
|
|
35
64
|
],
|
|
36
65
|
};
|
|
37
66
|
};
|
|
@@ -63,3 +92,4 @@ exports.searchFilesFunction = searchFilesFunction;
|
|
|
63
92
|
// `Favor calling getDeclarations over readFiles if full file content is not needed`,
|
|
64
93
|
// ],
|
|
65
94
|
// },
|
|
95
|
+
//# sourceMappingURL=KeywordToFilesIndexFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeywordToFilesIndexFunctions.js","sourceRoot":"","sources":["../../../../src/fs/keyword_to_files_index/KeywordToFilesIndexFunctions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEa,QAAA,uBAAuB,GAAG,aAAa,CAAC;AAC9C,IAAM,mBAAmB,GAAG,UAAC,MAAiC;IACnE,OAAO;QACL,UAAU,EAAE;YACV,IAAI,EAAE,+BAAuB;YAC7B,WAAW,EAAE,8CAA8C;YAC3D,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,+BAA+B;qBAC7C;iBACF;gBACD,QAAQ,EAAE,CAAC,SAAS,CAAC;aACtB;SACF;QACD,IAAI,EAAE,UAAO,MAA2B;YAAK,sBAAA,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAA;iBAAA;QACvE,YAAY,EAAE;YACZ,6IAAsI,+BAAuB,cAAW;YACxK,4JAAqJ,+BAAuB,cAAW;YACvL,uFAAgF,+BAAuB,iIAA8H;SACtO;KACF,CAAA;AACH,CAAC,CAAA;AAvBY,QAAA,mBAAmB,uBAuB/B;AAED,IAAI;AACE,kBAAkB;AAClB,+BAA+B;AAC/B,+DAA+D;AAC/D,oBAAoB;AACpB,wBAAwB;AACxB,sBAAsB;AACtB,yBAAyB;AACzB,2BAA2B;AAC3B,+CAA+C;AAC/C,qBAAqB;AACrB,8BAA8B;AAC9B,eAAe;AACf,aAAa;AACb,2CAA2C;AAC3C,6BAA6B;AAC7B,wHAAwH;AACxH,aAAa;AACb,WAAW;AACX,kCAAkC;AAClC,SAAS;AACT,OAAO;AACP,0FAA0F;AAC1F,oBAAoB;AACpB,yFAAyF;AACzF,OAAO;AACP,KAAK"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ConversationModule, ConversationModuleFactory } from '../../ConversationModule';
|
|
2
|
+
import { Function } from '../../Function';
|
|
3
|
+
export type KeywordToFilesIndexModuleParams = {
|
|
4
|
+
dir: string;
|
|
5
|
+
keywordFilesIndex: {
|
|
6
|
+
[keyword: string]: string[]; /** file paths */
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare class KeywordToFilesIndexModule implements ConversationModule {
|
|
10
|
+
private logger;
|
|
11
|
+
params: KeywordToFilesIndexModuleParams;
|
|
12
|
+
constructor(params: KeywordToFilesIndexModuleParams);
|
|
13
|
+
getName(): string;
|
|
14
|
+
searchFiles(params: {
|
|
15
|
+
keyword: string;
|
|
16
|
+
}): string[];
|
|
17
|
+
getSystemMessages(): string[];
|
|
18
|
+
getFunctions(): Function[];
|
|
19
|
+
getMessageModerators(): never[];
|
|
20
|
+
}
|
|
21
|
+
export declare class KeywordToFilesIndexModuleFactory implements ConversationModuleFactory {
|
|
22
|
+
private logger;
|
|
23
|
+
createModule(repoPath: string): Promise<KeywordToFilesIndexModule>;
|
|
24
|
+
/**
|
|
25
|
+
* Create keyword-files index for the given base directory.
|
|
26
|
+
*
|
|
27
|
+
* @param baseDir - The directory to start the file search from.
|
|
28
|
+
* @returns An index with keywords mapped to file paths.
|
|
29
|
+
*/
|
|
30
|
+
createKeywordFilesIndex(baseDir: string, globIgnorePatterns?: string[]): Promise<{
|
|
31
|
+
[keyword: string]: string[];
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=KeywordToFilesIndexModule.d.ts.map
|
|
@@ -0,0 +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,CAAA;AAED,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;IAM1B,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,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,GAAE,MAAM,EAAO,GAAG,OAAO,CAAC;QAAE,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAAC;CAyB5H"}
|
|
@@ -8,82 +8,139 @@ 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
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
48
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
49
|
};
|
|
14
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
51
|
exports.KeywordToFilesIndexModuleFactory = exports.KeywordToFilesIndexModule = void 0;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
52
|
+
var util_1 = require("@proteinjs/util");
|
|
53
|
+
var util_node_1 = require("@proteinjs/util-node");
|
|
54
|
+
var path_1 = __importDefault(require("path"));
|
|
55
|
+
var KeywordToFilesIndexFunctions_1 = require("./KeywordToFilesIndexFunctions");
|
|
56
|
+
var KeywordToFilesIndexModule = /** @class */ (function () {
|
|
57
|
+
function KeywordToFilesIndexModule(params) {
|
|
22
58
|
this.logger = new util_1.Logger(this.constructor.name);
|
|
23
59
|
this.params = params;
|
|
24
60
|
}
|
|
25
|
-
getName() {
|
|
61
|
+
KeywordToFilesIndexModule.prototype.getName = function () {
|
|
26
62
|
return 'Keyword to files index';
|
|
27
|
-
}
|
|
28
|
-
searchFiles(params) {
|
|
29
|
-
this.logger.info(
|
|
30
|
-
|
|
63
|
+
};
|
|
64
|
+
KeywordToFilesIndexModule.prototype.searchFiles = function (params) {
|
|
65
|
+
this.logger.info("Searching for file, keyword: ".concat(params.keyword));
|
|
66
|
+
var filePaths = this.params.keywordFilesIndex[params.keyword];
|
|
31
67
|
return filePaths || [];
|
|
32
|
-
}
|
|
33
|
-
getSystemMessages() {
|
|
68
|
+
};
|
|
69
|
+
KeywordToFilesIndexModule.prototype.getSystemMessages = function () {
|
|
34
70
|
return [
|
|
35
|
-
|
|
71
|
+
"If you're searching for something, use the ".concat(KeywordToFilesIndexFunctions_1.searchFilesFunctionName, " function to find a file matching the search string"),
|
|
36
72
|
];
|
|
37
|
-
}
|
|
38
|
-
getFunctions() {
|
|
73
|
+
};
|
|
74
|
+
KeywordToFilesIndexModule.prototype.getFunctions = function () {
|
|
39
75
|
return [
|
|
40
76
|
(0, KeywordToFilesIndexFunctions_1.searchFilesFunction)(this),
|
|
41
77
|
];
|
|
42
|
-
}
|
|
43
|
-
getMessageModerators() {
|
|
78
|
+
};
|
|
79
|
+
KeywordToFilesIndexModule.prototype.getMessageModerators = function () {
|
|
44
80
|
return [];
|
|
45
|
-
}
|
|
46
|
-
|
|
81
|
+
};
|
|
82
|
+
return KeywordToFilesIndexModule;
|
|
83
|
+
}());
|
|
47
84
|
exports.KeywordToFilesIndexModule = KeywordToFilesIndexModule;
|
|
48
|
-
|
|
49
|
-
|
|
85
|
+
var KeywordToFilesIndexModuleFactory = /** @class */ (function () {
|
|
86
|
+
function KeywordToFilesIndexModuleFactory() {
|
|
50
87
|
this.logger = new util_1.Logger(this.constructor.name);
|
|
51
88
|
}
|
|
52
|
-
createModule(repoPath) {
|
|
53
|
-
return __awaiter(this, void 0, void 0, function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
89
|
+
KeywordToFilesIndexModuleFactory.prototype.createModule = function (repoPath) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
91
|
+
var repoParams, _a;
|
|
92
|
+
return __generator(this, function (_b) {
|
|
93
|
+
switch (_b.label) {
|
|
94
|
+
case 0:
|
|
95
|
+
this.logger.debug("Creating module for repo: ".concat(repoPath));
|
|
96
|
+
repoParams = { keywordFilesIndex: {}, dir: repoPath };
|
|
97
|
+
_a = repoParams;
|
|
98
|
+
return [4 /*yield*/, this.createKeywordFilesIndex(repoPath, ['**/node-typescript-parser/**'])];
|
|
99
|
+
case 1:
|
|
100
|
+
_a.keywordFilesIndex = _b.sent();
|
|
101
|
+
this.logger.debug("Created module for repo: ".concat(repoPath));
|
|
102
|
+
return [2 /*return*/, new KeywordToFilesIndexModule(repoParams)];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
59
105
|
});
|
|
60
|
-
}
|
|
106
|
+
};
|
|
61
107
|
/**
|
|
62
108
|
* Create keyword-files index for the given base directory.
|
|
63
109
|
*
|
|
64
110
|
* @param baseDir - The directory to start the file search from.
|
|
65
111
|
* @returns An index with keywords mapped to file paths.
|
|
66
112
|
*/
|
|
67
|
-
createKeywordFilesIndex(baseDir, globIgnorePatterns
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
113
|
+
KeywordToFilesIndexModuleFactory.prototype.createKeywordFilesIndex = function (baseDir, globIgnorePatterns) {
|
|
114
|
+
if (globIgnorePatterns === void 0) { globIgnorePatterns = []; }
|
|
115
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
116
|
+
var filePaths, keywordFilesIndex, _i, filePaths_1, filePath, fileName;
|
|
117
|
+
return __generator(this, function (_a) {
|
|
118
|
+
switch (_a.label) {
|
|
119
|
+
case 0:
|
|
120
|
+
// Ensure the base directory has a trailing slash
|
|
121
|
+
if (!baseDir.endsWith(path_1.default.sep)) {
|
|
122
|
+
baseDir += path_1.default.sep;
|
|
123
|
+
}
|
|
124
|
+
return [4 /*yield*/, util_node_1.Fs.getFilePaths(baseDir, __spreadArray(['**/node_modules/**', '**/dist/**'], globIgnorePatterns, true))];
|
|
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];
|
|
81
139
|
}
|
|
82
|
-
|
|
83
|
-
keywordFilesIndex[fileName].push(filePath);
|
|
84
|
-
}
|
|
85
|
-
return keywordFilesIndex;
|
|
140
|
+
});
|
|
86
141
|
});
|
|
87
|
-
}
|
|
88
|
-
|
|
142
|
+
};
|
|
143
|
+
return KeywordToFilesIndexModuleFactory;
|
|
144
|
+
}());
|
|
89
145
|
exports.KeywordToFilesIndexModuleFactory = KeywordToFilesIndexModuleFactory;
|
|
146
|
+
//# sourceMappingURL=KeywordToFilesIndexModule.js.map
|
|
@@ -0,0 +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;YACL,IAAA,kDAAmB,EAAC,IAAI,CAAC;SAC1B,CAAC;IACJ,CAAC;IAED,wDAAoB,GAApB;QACE,OAAO,EAAE,CAAC;IACZ,CAAC;IACH,gCAAC;AAAD,CAAC,AAjCD,IAiCC;AAjCY,8DAAyB;AAmCtC;IAAA;QACU,WAAM,GAAG,IAAI,aAAM,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAyCrD,CAAC;IAvCO,uDAAY,GAAlB,UAAmB,QAAgB;;;;;;wBACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,oCAA6B,QAAQ,CAAE,CA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AAC,CAAC;yBAC9C;wBAED,sBAAO,iBAAiB,EAAC;;;;KAC1B;IACH,uCAAC;AAAD,CAAC,AA1CD,IA0CC;AA1CY,4EAAgC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Function } from '../../Function';
|
|
2
|
+
import { PackageModule } from './PackageModule';
|
|
3
|
+
export declare const installPackagesFunctionName = "installPackages";
|
|
4
|
+
export declare const installPackagesFunction: Function;
|
|
5
|
+
export declare const runPackageScriptFunctionName = "runPackageScript";
|
|
6
|
+
export declare const searchPackagesFunctionName = "searchPackages";
|
|
7
|
+
export declare function searchPackagesFunction(packageModule: PackageModule): {
|
|
8
|
+
definition: {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
parameters: {
|
|
12
|
+
type: string;
|
|
13
|
+
properties: {
|
|
14
|
+
keyword: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
required: string[];
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
call: (params: {
|
|
23
|
+
keyword: string;
|
|
24
|
+
}) => Promise<string[]>;
|
|
25
|
+
instructions: string[];
|
|
26
|
+
};
|
|
27
|
+
export declare const searchLibrariesFunctionName = "searchLibraries";
|
|
28
|
+
export declare function searchLibrariesFunction(packageModule: PackageModule): {
|
|
29
|
+
definition: {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
parameters: {
|
|
33
|
+
type: string;
|
|
34
|
+
properties: {
|
|
35
|
+
keyword: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
required: string[];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
call: (params: {
|
|
44
|
+
keyword: string;
|
|
45
|
+
}) => Promise<import("./PackageModule").Library[]>;
|
|
46
|
+
instructions: string[];
|
|
47
|
+
};
|
|
48
|
+
export declare const generateTypescriptDeclarationsFunctionName = "generateTypescriptDesclarations";
|
|
49
|
+
export declare const generateTypescriptDeclarationsFunction: {
|
|
50
|
+
definition: {
|
|
51
|
+
name: string;
|
|
52
|
+
description: string;
|
|
53
|
+
parameters: {
|
|
54
|
+
type: string;
|
|
55
|
+
properties: {
|
|
56
|
+
tsFilePaths: {
|
|
57
|
+
type: string;
|
|
58
|
+
description: string;
|
|
59
|
+
items: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
required: string[];
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
call: (params: {
|
|
68
|
+
tsFilePaths: string[];
|
|
69
|
+
}) => Promise<{
|
|
70
|
+
[tsFilePath: string]: string;
|
|
71
|
+
}>;
|
|
72
|
+
instructions: string[];
|
|
73
|
+
};
|
|
74
|
+
export declare const npmInstallFunctionName = "npmInstall";
|
|
75
|
+
export declare const npmInstallFunction: Function;
|
|
76
|
+
export declare const uninstallPackagesFunctionName = "uninstallPackages";
|
|
77
|
+
export declare const uninstallPackagesFunction: Function;
|
|
78
|
+
export declare const packageFunctions: Function[];
|
|
79
|
+
//# sourceMappingURL=PackageFunctions.d.ts.map
|
|
@@ -0,0 +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,QA6CrC,CAAA;AAED,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AA0B/D,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,wBAAgB,sBAAsB,CAAC,aAAa,EAAE,aAAa;;;;;;;;;;;;;;;mBAgB1C;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;;EAK3C;AAED,eAAO,MAAM,2BAA2B,oBAAoB,CAAC;AAC7D,wBAAgB,uBAAuB,CAAC,aAAa,EAAE,aAAa;;;;;;;;;;;;;;;mBAgB3C;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE;;EAK3C;AAED,eAAO,MAAM,0CAA0C,oCAAoC,CAAC;AAC5F,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;mBAkB5B;QAAE,WAAW,EAAE,MAAM,EAAE,CAAA;KAAE;;;;CAI/C,CAAA;AAED,eAAO,MAAM,sBAAsB,eAAe,CAAC;AACnD,eAAO,MAAM,kBAAkB,EAAE,QAmBhC,CAAA;AAED,eAAO,MAAM,6BAA6B,sBAAsB,CAAC;AACjE,eAAO,MAAM,yBAAyB,EAAE,QA2BvC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,QAAQ,EAMtC,CAAA"}
|
|
@@ -8,9 +8,36 @@ 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.packageFunctions = exports.uninstallPackagesFunction = exports.uninstallPackagesFunctionName = exports.npmInstallFunction = exports.npmInstallFunctionName = exports.generateTypescriptDeclarationsFunction = exports.generateTypescriptDeclarationsFunctionName = exports.searchLibrariesFunction = exports.searchLibrariesFunctionName = exports.searchPackagesFunction = exports.searchPackagesFunctionName = exports.runPackageScriptFunctionName = exports.installPackagesFunction = exports.installPackagesFunctionName = void 0;
|
|
13
|
-
|
|
40
|
+
var util_node_1 = require("@proteinjs/util-node");
|
|
14
41
|
exports.installPackagesFunctionName = 'installPackages';
|
|
15
42
|
exports.installPackagesFunction = {
|
|
16
43
|
definition: {
|
|
@@ -53,13 +80,18 @@ exports.installPackagesFunction = {
|
|
|
53
80
|
required: ['packages', 'cwdPath']
|
|
54
81
|
},
|
|
55
82
|
},
|
|
56
|
-
call: (params)
|
|
83
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
84
|
+
switch (_a.label) {
|
|
85
|
+
case 0: return [4 /*yield*/, util_node_1.PackageUtil.installPackages(params.packages, params.cwdPath)];
|
|
86
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
87
|
+
}
|
|
88
|
+
}); }); },
|
|
57
89
|
instructions: [
|
|
58
|
-
|
|
90
|
+
"To install a package, use the ".concat(exports.installPackagesFunctionName, " function"),
|
|
59
91
|
],
|
|
60
92
|
};
|
|
61
93
|
exports.runPackageScriptFunctionName = 'runPackageScript';
|
|
62
|
-
|
|
94
|
+
var runPackageScriptFunction = {
|
|
63
95
|
definition: {
|
|
64
96
|
name: exports.runPackageScriptFunctionName,
|
|
65
97
|
description: 'Run `npm run x`, where `x` is an existing script in a package.json',
|
|
@@ -78,13 +110,19 @@ const runPackageScriptFunction = {
|
|
|
78
110
|
required: ['name']
|
|
79
111
|
},
|
|
80
112
|
},
|
|
81
|
-
call: (params)
|
|
113
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
114
|
+
switch (_a.label) {
|
|
115
|
+
case 0: return [4 /*yield*/, util_node_1.PackageUtil.runPackageScript(params.name, params.cwdPath)];
|
|
116
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
117
|
+
}
|
|
118
|
+
}); }); },
|
|
82
119
|
instructions: [
|
|
83
|
-
|
|
120
|
+
"To run a npm script (such as start, test, or watch), use the ".concat(exports.runPackageScriptFunctionName, " function"),
|
|
84
121
|
],
|
|
85
122
|
};
|
|
86
123
|
exports.searchPackagesFunctionName = 'searchPackages';
|
|
87
124
|
function searchPackagesFunction(packageModule) {
|
|
125
|
+
var _this = this;
|
|
88
126
|
return {
|
|
89
127
|
definition: {
|
|
90
128
|
name: exports.searchPackagesFunctionName,
|
|
@@ -100,15 +138,21 @@ function searchPackagesFunction(packageModule) {
|
|
|
100
138
|
required: ['keyword']
|
|
101
139
|
},
|
|
102
140
|
},
|
|
103
|
-
call: (params)
|
|
141
|
+
call: function (params) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
142
|
+
switch (_a.label) {
|
|
143
|
+
case 0: return [4 /*yield*/, packageModule.searchPackages(params.keyword)];
|
|
144
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
145
|
+
}
|
|
146
|
+
}); }); },
|
|
104
147
|
instructions: [
|
|
105
|
-
|
|
148
|
+
"To search for packages in the local repo, use the ".concat(exports.searchPackagesFunctionName, " function"),
|
|
106
149
|
],
|
|
107
150
|
};
|
|
108
151
|
}
|
|
109
152
|
exports.searchPackagesFunction = searchPackagesFunction;
|
|
110
153
|
exports.searchLibrariesFunctionName = 'searchLibraries';
|
|
111
154
|
function searchLibrariesFunction(packageModule) {
|
|
155
|
+
var _this = this;
|
|
112
156
|
return {
|
|
113
157
|
definition: {
|
|
114
158
|
name: exports.searchLibrariesFunctionName,
|
|
@@ -124,9 +168,14 @@ function searchLibrariesFunction(packageModule) {
|
|
|
124
168
|
required: ['keyword']
|
|
125
169
|
},
|
|
126
170
|
},
|
|
127
|
-
call: (params)
|
|
171
|
+
call: function (params) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
172
|
+
switch (_a.label) {
|
|
173
|
+
case 0: return [4 /*yield*/, packageModule.searchLibraries(params.keyword)];
|
|
174
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
175
|
+
}
|
|
176
|
+
}); }); },
|
|
128
177
|
instructions: [
|
|
129
|
-
|
|
178
|
+
"To search for libraries in the local repo, use the ".concat(exports.searchLibrariesFunctionName, " function"),
|
|
130
179
|
],
|
|
131
180
|
};
|
|
132
181
|
}
|
|
@@ -150,9 +199,11 @@ exports.generateTypescriptDeclarationsFunction = {
|
|
|
150
199
|
required: ['tsFilePaths']
|
|
151
200
|
},
|
|
152
201
|
},
|
|
153
|
-
call: (params)
|
|
202
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
203
|
+
return [2 /*return*/, util_node_1.PackageUtil.generateTypescriptDeclarations(params)];
|
|
204
|
+
}); }); },
|
|
154
205
|
instructions: [
|
|
155
|
-
|
|
206
|
+
"To generate typescript declarations for a local file, use the ".concat(exports.generateTypescriptDeclarationsFunctionName, " function"),
|
|
156
207
|
],
|
|
157
208
|
};
|
|
158
209
|
exports.npmInstallFunctionName = 'npmInstall';
|
|
@@ -171,9 +222,14 @@ exports.npmInstallFunction = {
|
|
|
171
222
|
required: ['cwdPath']
|
|
172
223
|
},
|
|
173
224
|
},
|
|
174
|
-
call: (params)
|
|
225
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
226
|
+
switch (_a.label) {
|
|
227
|
+
case 0: return [4 /*yield*/, util_node_1.PackageUtil.npmInstall(params.cwdPath)];
|
|
228
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
229
|
+
}
|
|
230
|
+
}); }); },
|
|
175
231
|
instructions: [
|
|
176
|
-
|
|
232
|
+
"To run npm install in a specific directory, use the ".concat(exports.npmInstallFunctionName, " function"),
|
|
177
233
|
],
|
|
178
234
|
};
|
|
179
235
|
exports.uninstallPackagesFunctionName = 'uninstallPackages';
|
|
@@ -200,9 +256,14 @@ exports.uninstallPackagesFunction = {
|
|
|
200
256
|
required: ['packageNames', 'cwdPath']
|
|
201
257
|
},
|
|
202
258
|
},
|
|
203
|
-
call: (params)
|
|
259
|
+
call: function (params) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
260
|
+
switch (_a.label) {
|
|
261
|
+
case 0: return [4 /*yield*/, util_node_1.PackageUtil.uninstallPackages(params.packageNames, params.cwdPath)];
|
|
262
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
263
|
+
}
|
|
264
|
+
}); }); },
|
|
204
265
|
instructions: [
|
|
205
|
-
|
|
266
|
+
"To uninstall a package, use the ".concat(exports.uninstallPackagesFunctionName, " function"),
|
|
206
267
|
],
|
|
207
268
|
};
|
|
208
269
|
exports.packageFunctions = [
|
|
@@ -212,3 +273,4 @@ exports.packageFunctions = [
|
|
|
212
273
|
exports.npmInstallFunction,
|
|
213
274
|
exports.uninstallPackagesFunction,
|
|
214
275
|
];
|
|
276
|
+
//# sourceMappingURL=PackageFunctions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PackageFunctions.js","sourceRoot":"","sources":["../../../../src/fs/package/PackageFunctions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAA4D;AAI/C,QAAA,2BAA2B,GAAG,iBAAiB,CAAC;AAChD,QAAA,uBAAuB,GAAa;IAC/C,UAAU,EAAE;QACV,IAAI,EAAE,mCAA2B;QACjC,WAAW,EAAE,0BAA0B;QACvC,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,qBAAqB;oBAClC,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE;4BACV,IAAI,EAAE;gCACJ,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,iBAAiB;6BAC/B;4BACD,OAAO,EAAE;gCACP,IAAI,EAAE,QAAQ;gCACd,WAAW,EAAE,oBAAoB;6BAClC;4BACD,YAAY,EAAE;gCACZ,IAAI,EAAE,SAAS;gCACf,WAAW,EAAE,+EAA+E;6BAC7F;4BACD,WAAW,EAAE;gCACX,IAAI,EAAE,SAAS;gCACf,WAAW,EAAE,sCAAsC;6BACpD;yBACF;wBACD,QAAQ,EAAE,CAAC,MAAM,CAAC;qBACnB;iBACF;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sCAAsC;iBACpD;aACF;YACD,QA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AM,uBAAW,CAAC,iBAAiB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,EAAA;oBAAxE,sBAAA,SAAwE,EAAA;;aAAA;IAC7I,YAAY,EAAE;QACZ,0CAAmC,qCAA6B,cAAW;KAC5E;CACF,CAAA;AAEY,QAAA,gBAAgB,GAAe;IAC1C,+BAAuB;IACvB,wBAAwB;IACxB,8CAAsC;IACtC,0BAAkB;IAClB,iCAAyB;CAC1B,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ConversationModule, ConversationModuleFactory } from '../../ConversationModule';
|
|
2
|
+
import { Function } from '../../Function';
|
|
3
|
+
export type Library = {
|
|
4
|
+
fileName: string;
|
|
5
|
+
filePath: string;
|
|
6
|
+
packageName: string;
|
|
7
|
+
};
|
|
8
|
+
export type LibraryImport = {
|
|
9
|
+
importStatements: string[];
|
|
10
|
+
typescriptDeclaration: string;
|
|
11
|
+
};
|
|
12
|
+
export declare class PackageModule implements ConversationModule {
|
|
13
|
+
private repoPath;
|
|
14
|
+
constructor(repoPath: string);
|
|
15
|
+
getName(): string;
|
|
16
|
+
getSystemMessages(): string[];
|
|
17
|
+
getFunctions(): Function[];
|
|
18
|
+
getMessageModerators(): never[];
|
|
19
|
+
/**
|
|
20
|
+
* @param keyword either the package name or some substring
|
|
21
|
+
* @return string[] of file paths
|
|
22
|
+
*/
|
|
23
|
+
searchPackages(keyword: string): Promise<string[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Search packages in repo for file names that include keyword
|
|
26
|
+
* @param keyword substring of file name to search for
|
|
27
|
+
* @returns all libraries in the repo matching the keyword
|
|
28
|
+
*/
|
|
29
|
+
searchLibraries(keyword: string): Promise<Library[]>;
|
|
30
|
+
}
|
|
31
|
+
export declare class PackageModuleFactory implements ConversationModuleFactory {
|
|
32
|
+
createModule(repoPath: string): Promise<PackageModule>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=PackageModule.d.ts.map
|