@rxap/plugin-gpt 19.0.3-dev.0 → 19.0.3-dev.2
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 +12 -0
- package/generators.json +5 -0
- package/package.json +7 -7
- package/src/generators/documentation/add-js-doc.d.ts +3 -0
- package/src/generators/documentation/add-js-doc.js +12 -0
- package/src/generators/documentation/add-js-doc.js.map +1 -0
- package/src/generators/documentation/cleanup-js-doc.d.ts +1 -0
- package/src/generators/documentation/cleanup-js-doc.js +18 -0
- package/src/generators/documentation/cleanup-js-doc.js.map +1 -0
- package/src/generators/documentation/const.d.ts +3 -0
- package/src/generators/documentation/const.js +9 -0
- package/src/generators/documentation/const.js.map +1 -0
- package/src/generators/documentation/generator.js +19 -177
- package/src/generators/documentation/generator.js.map +1 -1
- package/src/generators/documentation/has-js-doc.d.ts +2 -0
- package/src/generators/documentation/has-js-doc.js +8 -0
- package/src/generators/documentation/has-js-doc.js.map +1 -0
- package/src/generators/documentation/load-system-prompt.d.ts +1 -0
- package/src/generators/documentation/load-system-prompt.js +14 -0
- package/src/generators/documentation/load-system-prompt.js.map +1 -0
- package/src/generators/documentation/open-ai-instance.d.ts +4 -0
- package/src/generators/documentation/open-ai-instance.js +31 -0
- package/src/generators/documentation/open-ai-instance.js.map +1 -0
- package/src/generators/documentation/process-class.d.ts +3 -0
- package/src/generators/documentation/process-class.js +15 -0
- package/src/generators/documentation/process-class.js.map +1 -0
- package/src/generators/documentation/process-function.d.ts +3 -0
- package/src/generators/documentation/process-function.js +30 -0
- package/src/generators/documentation/process-function.js.map +1 -0
- package/src/generators/documentation/process-method.d.ts +3 -0
- package/src/generators/documentation/process-method.js +30 -0
- package/src/generators/documentation/process-method.js.map +1 -0
- package/src/generators/documentation/process-project.d.ts +3 -0
- package/src/generators/documentation/process-project.js +40 -0
- package/src/generators/documentation/process-project.js.map +1 -0
- package/src/generators/documentation/process-source-file.d.ts +3 -0
- package/src/generators/documentation/process-source-file.js +19 -0
- package/src/generators/documentation/process-source-file.js.map +1 -0
- package/src/generators/documentation/prompt.d.ts +1 -0
- package/src/generators/documentation/prompt.js +16 -0
- package/src/generators/documentation/prompt.js.map +1 -0
- package/src/generators/documentation/schema.d.ts +2 -0
- package/src/generators/documentation/schema.json +8 -0
- package/src/generators/documentation/simple-prompt.d.ts +8 -4
- package/src/generators/documentation/simple-prompt.js +26 -6
- package/src/generators/documentation/simple-prompt.js.map +1 -1
- package/src/generators/documentation/skip-source-file.d.ts +2 -0
- package/src/generators/documentation/skip-source-file.js +30 -0
- package/src/generators/documentation/skip-source-file.js.map +1 -0
- package/src/generators/documentation/system-prompts/class.txt +36 -0
- package/src/generators/documentation/system-prompts/function.txt +39 -1
- package/src/generators/documentation/system-prompts/method.txt +41 -0
- package/src/generators/init/generator.d.ts +4 -0
- package/src/generators/init/generator.js +106 -0
- package/src/generators/init/generator.js.map +1 -0
- package/src/generators/init/schema.d.ts +2 -0
- package/src/generators/init/schema.json +8 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [19.0.3-dev.2](https://gitlab.com/rxap/packages/compare/@rxap/plugin-gpt@19.0.3-dev.1...@rxap/plugin-gpt@19.0.3-dev.2) (2024-06-21)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @rxap/plugin-gpt
|
|
9
|
+
|
|
10
|
+
## [19.0.3-dev.1](https://gitlab.com/rxap/packages/compare/@rxap/plugin-gpt@19.0.3-dev.0...@rxap/plugin-gpt@19.0.3-dev.1) (2024-06-20)
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- add html code coverage reporters ([73da1d8](https://gitlab.com/rxap/packages/commit/73da1d85274686590952a97e202c713718988caa))
|
|
15
|
+
- update openapi package ([d5afabe](https://gitlab.com/rxap/packages/commit/d5afabec58c65d3178129b826f016e1c593b8846))
|
|
16
|
+
- update to new openai models ([882aab3](https://gitlab.com/rxap/packages/commit/882aab3575ba99c7e271969fa94e2f2bb9361b2c))
|
|
17
|
+
|
|
6
18
|
## [19.0.3-dev.0](https://gitlab.com/rxap/packages/compare/@rxap/plugin-gpt@19.0.2...@rxap/plugin-gpt@19.0.3-dev.0) (2024-06-18)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @rxap/plugin-gpt
|
package/generators.json
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
"factory": "./src/generators/documentation/generator",
|
|
5
5
|
"schema": "./src/generators/documentation/schema.json",
|
|
6
6
|
"description": "documentation generator"
|
|
7
|
+
},
|
|
8
|
+
"init": {
|
|
9
|
+
"factory": "./src/generators/init/generator",
|
|
10
|
+
"schema": "./src/generators/init/schema.json",
|
|
11
|
+
"description": "Initialize the package in the workspace"
|
|
7
12
|
}
|
|
8
13
|
},
|
|
9
14
|
"schematics": {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "19.0.3-dev.
|
|
2
|
+
"version": "19.0.3-dev.2",
|
|
3
3
|
"name": "@rxap/plugin-gpt",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@nx/devkit": "19.3.0",
|
|
7
|
-
"@rxap/
|
|
8
|
-
"@rxap/ts-morph": "^1.
|
|
9
|
-
"@rxap/workspace-utilities": "^19.
|
|
10
|
-
"gpt-3-encoder": "1.1.4",
|
|
11
|
-
"openai": "
|
|
7
|
+
"@rxap/ts-morph": "^1.4.1-dev.1",
|
|
8
|
+
"@rxap/workspace-ts-morph": "^19.1.1-dev.2",
|
|
9
|
+
"@rxap/workspace-utilities": "^19.3.0-dev.1",
|
|
10
|
+
"gpt-3-encoder": "^1.1.4",
|
|
11
|
+
"openai": "^4.52.0",
|
|
12
12
|
"ts-morph": "18.0.0",
|
|
13
13
|
"tslib": "2.6.2"
|
|
14
14
|
},
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
},
|
|
44
44
|
"schematics": "./generators.json",
|
|
45
45
|
"type": "commonjs",
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "bbecc3ca89ac11dedf7969bed08705f22dfaa186",
|
|
47
47
|
"main": "./src/index.js"
|
|
48
48
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addJsDoc = void 0;
|
|
4
|
+
const cleanup_js_doc_1 = require("./cleanup-js-doc");
|
|
5
|
+
function addJsDoc(options, node, jsDoc) {
|
|
6
|
+
if (options.offline) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
node.addJsDoc((0, cleanup_js_doc_1.cleanupJsDoc)(jsDoc));
|
|
10
|
+
}
|
|
11
|
+
exports.addJsDoc = addJsDoc;
|
|
12
|
+
//# sourceMappingURL=add-js-doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-js-doc.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/add-js-doc.ts"],"names":[],"mappings":";;;AACA,qDAAgD;AAGhD,SAAgB,QAAQ,CAAC,OAAqC,EAAE,IAAmB,EAAE,KAAa;IAEhG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IAED,IAAI,CAAC,QAAQ,CAAC,IAAA,6BAAY,EAAC,KAAK,CAAC,CAAC,CAAC;AACrC,CAAC;AAPD,4BAOC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cleanupJsDoc(jsDoc: string): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanupJsDoc = void 0;
|
|
4
|
+
function cleanupJsDoc(jsDoc) {
|
|
5
|
+
const cleanJsDocArray = jsDoc
|
|
6
|
+
.split('\n')
|
|
7
|
+
.map(line => line
|
|
8
|
+
.trim()
|
|
9
|
+
.replace(/^\/\*\*/, '')
|
|
10
|
+
.replace(/^\s?\*\//, '')
|
|
11
|
+
.replace(/^\s?\*\s?/, '')
|
|
12
|
+
.replace(/^\s?\*\s```typescript/, ' *')
|
|
13
|
+
.trim());
|
|
14
|
+
cleanJsDocArray.pop();
|
|
15
|
+
return cleanJsDocArray.join('\n');
|
|
16
|
+
}
|
|
17
|
+
exports.cleanupJsDoc = cleanupJsDoc;
|
|
18
|
+
//# sourceMappingURL=cleanup-js-doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanup-js-doc.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/cleanup-js-doc.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,KAAa;IAExC,MAAM,eAAe,GAAG,KAAK;SAC1B,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI;SACd,IAAI,EAAE;SACN,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;SACtB,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;SACxB,OAAO,CAAC,uBAAuB,EAAE,IAAI,CAAC;SACtC,IAAI,EAAE,CACR,CAAC;IAEJ,eAAe,CAAC,GAAG,EAAE,CAAC;IAEtB,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEpC,CAAC;AAjBD,oCAiBC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MAX_TIME = exports.METHOD_SYSTEM_PROMPT = exports.FUNCTION_SYSTEM_PROMPT = void 0;
|
|
4
|
+
const load_system_prompt_1 = require("./load-system-prompt");
|
|
5
|
+
exports.FUNCTION_SYSTEM_PROMPT = (0, load_system_prompt_1.loadSystemPrompt)('function');
|
|
6
|
+
exports.METHOD_SYSTEM_PROMPT = (0, load_system_prompt_1.loadSystemPrompt)('method');
|
|
7
|
+
const CLASS_SYSTEM_PROMPT = (0, load_system_prompt_1.loadSystemPrompt)('class');
|
|
8
|
+
exports.MAX_TIME = 1000 * 60 * 60 * 0.5;
|
|
9
|
+
//# sourceMappingURL=const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/const.ts"],"names":[],"mappings":";;;AAAA,6DAAwD;AAE3C,QAAA,sBAAsB,GAAG,IAAA,qCAAgB,EAAC,UAAU,CAAC,CAAC;AACtD,QAAA,oBAAoB,GAAG,IAAA,qCAAgB,EAAC,QAAQ,CAAC,CAAC;AAC/D,MAAM,mBAAmB,GAAG,IAAA,qCAAgB,EAAC,OAAO,CAAC,CAAC;AACzC,QAAA,QAAQ,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,GAAG,CAAC"}
|
|
@@ -3,177 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.documentationGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const generator_ts_morph_1 = require("@rxap/generator-ts-morph");
|
|
7
|
-
const ts_morph_1 = require("@rxap/ts-morph");
|
|
8
|
-
const workspace_utilities_1 = require("@rxap/workspace-utilities");
|
|
9
|
-
const fs_1 = require("fs");
|
|
10
|
-
const openai_1 = require("openai");
|
|
11
|
-
const path_1 = require("path");
|
|
12
6
|
const process = require("process");
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
if (!process.env.OPENAI_API_KEY) {
|
|
16
|
-
throw new Error('Can not find OPENAI_API_KEY environment variable');
|
|
17
|
-
}
|
|
18
|
-
const configuration = new openai_1.Configuration(Object.assign(Object.assign({}, param), { apiKey: process.env.OPENAI_API_KEY }));
|
|
19
|
-
return new openai_1.OpenAIApi(configuration);
|
|
20
|
-
}
|
|
21
|
-
function loadSystemPrompt(name) {
|
|
22
|
-
const filePath = (0, path_1.join)(__dirname, 'system-prompts', `${name}.txt`);
|
|
23
|
-
if (!(0, fs_1.existsSync)(filePath)) {
|
|
24
|
-
throw new Error(`Can not find system prompt file '${filePath}'`);
|
|
25
|
-
}
|
|
26
|
-
return (0, fs_1.readFileSync)(filePath).toString();
|
|
27
|
-
}
|
|
28
|
-
const FUNCTION_SYSTEM_PROMPT = loadSystemPrompt('function');
|
|
29
|
-
const METHOD_SYSTEM_PROMPT = loadSystemPrompt('method');
|
|
30
|
-
const CLASS_SYSTEM_PROMPT = loadSystemPrompt('class');
|
|
31
|
-
function hasJsDoc(node) {
|
|
32
|
-
return node.getJsDocs().length > 0;
|
|
33
|
-
}
|
|
34
|
-
function prompt(options, systemPrompt, prompt) {
|
|
35
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
if (options.offline) {
|
|
37
|
-
return '';
|
|
38
|
-
}
|
|
39
|
-
return (0, simple_prompt_1.SimplePrompt)(systemPrompt, prompt, getOpenAi());
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
function cleanupJsDoc(jsDoc) {
|
|
43
|
-
const cleanJsDocArray = jsDoc
|
|
44
|
-
.split('\n')
|
|
45
|
-
.map(line => line
|
|
46
|
-
.trim()
|
|
47
|
-
.replace(/^\/\*\*/, '')
|
|
48
|
-
.replace(/^\s?\*\//, '')
|
|
49
|
-
.replace(/^\s?\*\s?/, '')
|
|
50
|
-
.trim());
|
|
51
|
-
cleanJsDocArray.pop();
|
|
52
|
-
return cleanJsDocArray.join('\n');
|
|
53
|
-
}
|
|
54
|
-
function addJsDoc(options, node, jsDoc) {
|
|
55
|
-
if (options.offline) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
node.addJsDoc(cleanupJsDoc(jsDoc));
|
|
59
|
-
}
|
|
60
|
-
function processMethod(options, project, sourceFile, methodDeclaration) {
|
|
61
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
62
|
-
console.log(`====== Process method: \x1b[36m${methodDeclaration.getName()}\x1b[0m`);
|
|
63
|
-
if (hasJsDoc(methodDeclaration)) {
|
|
64
|
-
console.log(`\x1b[33mMethod has already a documentation\x1b[0m`);
|
|
65
|
-
return false;
|
|
66
|
-
}
|
|
67
|
-
const methodText = methodDeclaration.getText();
|
|
68
|
-
console.log('Method text:');
|
|
69
|
-
console.log(methodText);
|
|
70
|
-
const jsDoc = yield prompt(options, METHOD_SYSTEM_PROMPT, methodText);
|
|
71
|
-
console.log('Method documentation:');
|
|
72
|
-
console.log(jsDoc);
|
|
73
|
-
addJsDoc(options, methodDeclaration, jsDoc);
|
|
74
|
-
return true;
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function processClass(options, project, sourceFile, classDeclaration) {
|
|
78
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
console.log(`====== Process class: \x1b[36m${classDeclaration.getName()}\x1b[0m`);
|
|
80
|
-
let changed = false;
|
|
81
|
-
for (const md of classDeclaration.getMethods()) {
|
|
82
|
-
const scope = md.getScope();
|
|
83
|
-
if (scope === 'public' || scope === undefined) {
|
|
84
|
-
const hasChanged = yield processMethod(options, project, sourceFile, md);
|
|
85
|
-
changed = changed || hasChanged;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return changed;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
function processFunction(options, project, sourceFile, functionDeclaration) {
|
|
92
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
93
|
-
console.log(`====== Process function: \x1b[36m${functionDeclaration.getName()}\x1b[0m`);
|
|
94
|
-
if (hasJsDoc(functionDeclaration)) {
|
|
95
|
-
console.log(`\x1b[33mFunction has already a documentation\x1b[0m`);
|
|
96
|
-
return false;
|
|
97
|
-
}
|
|
98
|
-
const functionText = functionDeclaration.getText();
|
|
99
|
-
console.log('Function text:');
|
|
100
|
-
console.log(functionText);
|
|
101
|
-
const jsDoc = yield prompt(options, FUNCTION_SYSTEM_PROMPT, functionText);
|
|
102
|
-
console.log('Function documentation:');
|
|
103
|
-
console.log(jsDoc);
|
|
104
|
-
addJsDoc(options, functionDeclaration, jsDoc);
|
|
105
|
-
return true;
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function processSourceFile(options, project, sourceFile) {
|
|
109
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
110
|
-
console.log(`====== Process source file: \x1b[35m${sourceFile.getFilePath()}\x1b[0m`);
|
|
111
|
-
let changed = false;
|
|
112
|
-
for (const fd of sourceFile.getFunctions()) {
|
|
113
|
-
const hasChanged = yield processFunction(options, project, sourceFile, fd);
|
|
114
|
-
changed = changed || hasChanged;
|
|
115
|
-
}
|
|
116
|
-
for (const cd of sourceFile.getClasses()) {
|
|
117
|
-
const hasChanged = yield processClass(options, project, sourceFile, cd);
|
|
118
|
-
changed = changed || hasChanged;
|
|
119
|
-
}
|
|
120
|
-
return changed;
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function skipSourceFile(sourceFile, filter) {
|
|
124
|
-
if (sourceFile.getBaseName() === 'index.ts') {
|
|
125
|
-
// console.log(`\x1b[33mSkip index file: \x1b[0m${ sourceFile.getFilePath() }`);
|
|
126
|
-
return true;
|
|
127
|
-
}
|
|
128
|
-
if (sourceFile.getBaseName().endsWith('.spec.ts')) {
|
|
129
|
-
// console.log(`\x1b[33mSkip spec file: \x1b[0m${ sourceFile.getFilePath() }`);
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
if (sourceFile.getBaseName().endsWith('.stories.ts')) {
|
|
133
|
-
// console.log(`\x1b[33mSkip stories file: \x1b[0m${ sourceFile.getFilePath() }`);
|
|
134
|
-
return true;
|
|
135
|
-
}
|
|
136
|
-
if (sourceFile.getBaseName().endsWith('.cy.ts')) {
|
|
137
|
-
// console.log(`\x1b[33mSkip cypress file: \x1b[0m${ sourceFile.getFilePath() }`);
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
if (filter) {
|
|
141
|
-
if (!sourceFile.getFilePath().includes(filter)) {
|
|
142
|
-
// console.log(`\x1b[33mSkip file: \x1b[0m${ sourceFile.getFilePath() }`);
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
function processProject(options, projectName, tree) {
|
|
149
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
150
|
-
const projectSourceRoot = (0, workspace_utilities_1.GetProjectSourceRoot)(tree, projectName);
|
|
151
|
-
const project = (0, ts_morph_1.CreateProject)();
|
|
152
|
-
(0, generator_ts_morph_1.AddDir)(tree, projectSourceRoot, project);
|
|
153
|
-
const start = Date.now();
|
|
154
|
-
for (const sourceFile of project.getSourceFiles()) {
|
|
155
|
-
if (skipSourceFile(sourceFile, options.filter)) {
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
|
-
try {
|
|
159
|
-
const changed = yield processSourceFile(options, project, sourceFile);
|
|
160
|
-
if (changed) {
|
|
161
|
-
(0, workspace_utilities_1.CoerceFile)(tree, (0, path_1.join)(projectSourceRoot, sourceFile.getFilePath()), sourceFile.getFullText(), true);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
catch (e) {
|
|
165
|
-
console.error(`\x1b[31mError processing file: \x1b[0m${sourceFile.getFilePath()}`);
|
|
166
|
-
console.error(e.message);
|
|
167
|
-
console.error(e.stack);
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
if (Date.now() - start > MAX_TIME) {
|
|
171
|
-
console.log(`\x1b[33mMax time reached: \x1b[0m${MAX_TIME}`);
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
}
|
|
7
|
+
const open_ai_instance_1 = require("./open-ai-instance");
|
|
8
|
+
const process_project_1 = require("./process-project");
|
|
177
9
|
function skipProject(project, projectName, options) {
|
|
178
10
|
var _a;
|
|
179
11
|
if ((_a = options.projects) === null || _a === void 0 ? void 0 : _a.length) {
|
|
@@ -181,21 +13,31 @@ function skipProject(project, projectName, options) {
|
|
|
181
13
|
}
|
|
182
14
|
return false;
|
|
183
15
|
}
|
|
184
|
-
const MAX_TIME = 1000 * 60 * 60 * 0.5;
|
|
185
16
|
function documentationGenerator(tree, options) {
|
|
186
17
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
const openaiApiKey = (_a = options.openaiApiKey) !== null && _a !== void 0 ? _a : process.env.OPENAI_API_KEY;
|
|
20
|
+
const openaiOrganization = (_b = options.openaiOrgId) !== null && _b !== void 0 ? _b : process.env.OPENAI_ORG_ID;
|
|
21
|
+
const openaiProjectId = (_c = options.openaiProjectId) !== null && _c !== void 0 ? _c : process.env.OPENAI_PROJECT_ID;
|
|
22
|
+
if (!openaiApiKey) {
|
|
191
23
|
throw new Error('Can not find OPENAI_API_KEY environment variable');
|
|
192
24
|
}
|
|
193
|
-
|
|
25
|
+
if (!openaiOrganization) {
|
|
26
|
+
throw new Error('Can not find OPENAI_ORGANIZATION environment variable');
|
|
27
|
+
}
|
|
28
|
+
if (!openaiProjectId) {
|
|
29
|
+
throw new Error('Can not find OPENAI_PROJECT_ID environment variable');
|
|
30
|
+
}
|
|
31
|
+
yield (0, open_ai_instance_1.createOpenApi)({
|
|
32
|
+
apiKey: openaiApiKey,
|
|
33
|
+
organization: openaiOrganization,
|
|
34
|
+
project: openaiProjectId,
|
|
35
|
+
});
|
|
194
36
|
for (const [projectName, project] of (0, devkit_1.getProjects)(tree).entries()) {
|
|
195
37
|
if (skipProject(project, projectName, options)) {
|
|
196
38
|
continue;
|
|
197
39
|
}
|
|
198
|
-
yield processProject(options, projectName, tree);
|
|
40
|
+
yield (0, process_project_1.processProject)(options, projectName, tree);
|
|
199
41
|
}
|
|
200
42
|
});
|
|
201
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAIoB;AACpB,
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAIoB;AACpB,mCAAmC;AACnC,yDAAmD;AACnD,uDAAmD;AAGnD,SAAS,WAAW,CAAC,OAA6B,EAAE,WAAmB,EAAE,OAAqC;;IAE5G,IAAI,MAAA,OAAO,CAAC,QAAQ,0CAAE,MAAM,EAAE,CAAC;QAC7B,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,KAAK,CAAC;AAEf,CAAC;AAED,SAAsB,sBAAsB,CAC1C,IAAU,EACV,OAAqC;;;QAGrC,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,YAAY,mCAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;QACxE,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,WAAW,mCAAI,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QAC5E,MAAM,eAAe,GAAG,MAAA,OAAO,CAAC,eAAe,mCAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;QAEjF,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;QACtE,CAAC;QAED,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;QAC3E,CAAC;QAED,IAAI,CAAC,eAAe,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,IAAA,gCAAa,EAAC;YAClB,MAAM,EAAE,YAAY;YACpB,YAAY,EAAE,kBAAkB;YAChC,OAAO,EAAE,eAAe;SACzB,CAAC,CAAC;QAEH,KAAK,MAAM,CAAE,WAAW,EAAE,OAAO,CAAE,IAAI,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;YAEnE,IAAI,WAAW,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC;gBAC/C,SAAS;YACX,CAAC;YAED,MAAM,IAAA,gCAAc,EAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC;QAEnD,CAAC;IAEH,CAAC;CAAA;AArCD,wDAqCC;AAED,kBAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-js-doc.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/has-js-doc.ts"],"names":[],"mappings":";;;AAEA,SAAgB,QAAQ,CAAC,IAAmB;IAC1C,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AACrC,CAAC;AAFD,4BAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function loadSystemPrompt(name: string): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadSystemPrompt = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function loadSystemPrompt(name) {
|
|
7
|
+
const filePath = (0, path_1.join)(__dirname, 'system-prompts', `${name}.txt`);
|
|
8
|
+
if (!(0, fs_1.existsSync)(filePath)) {
|
|
9
|
+
throw new Error(`Can not find system prompt file '${filePath}'`);
|
|
10
|
+
}
|
|
11
|
+
return (0, fs_1.readFileSync)(filePath).toString();
|
|
12
|
+
}
|
|
13
|
+
exports.loadSystemPrompt = loadSystemPrompt;
|
|
14
|
+
//# sourceMappingURL=load-system-prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-system-prompt.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/load-system-prompt.ts"],"names":[],"mappings":";;;AAAA,2BAGY;AACZ,+BAA4B;AAE5B,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,MAAM,QAAQ,GAAG,IAAA,WAAI,EAAC,SAAS,EAAE,gBAAgB,EAAE,GAAI,IAAK,MAAM,CAAC,CAAC;IACpE,IAAI,CAAC,IAAA,eAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,oCAAqC,QAAS,GAAG,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,IAAA,iBAAY,EAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC3C,CAAC;AAND,4CAMC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOpenAi = exports.createOpenApi = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const openai_1 = require("openai");
|
|
6
|
+
let OPENAI_INSTANCE = null;
|
|
7
|
+
function createOpenApi(param) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
if (OPENAI_INSTANCE) {
|
|
10
|
+
return OPENAI_INSTANCE;
|
|
11
|
+
}
|
|
12
|
+
OPENAI_INSTANCE = new openai_1.OpenAI(param);
|
|
13
|
+
yield OPENAI_INSTANCE.models.list()
|
|
14
|
+
.catch(() => console.error('Error listing models'))
|
|
15
|
+
.then(models => {
|
|
16
|
+
if (models) {
|
|
17
|
+
console.log('Models:', models.data.map(model => model.id));
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
return OPENAI_INSTANCE;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
exports.createOpenApi = createOpenApi;
|
|
24
|
+
function getOpenAi() {
|
|
25
|
+
if (!OPENAI_INSTANCE) {
|
|
26
|
+
throw new Error('OpenAI instance is not created');
|
|
27
|
+
}
|
|
28
|
+
return OPENAI_INSTANCE;
|
|
29
|
+
}
|
|
30
|
+
exports.getOpenAi = getOpenAi;
|
|
31
|
+
//# sourceMappingURL=open-ai-instance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-ai-instance.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/open-ai-instance.ts"],"names":[],"mappings":";;;;AAAA,mCAAgC;AAGhC,IAAI,eAAe,GAAkB,IAAI,CAAC;AAE1C,SAAsB,aAAa,CAAC,KAAoB;;QAEtD,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,eAAe,CAAC;QACzB,CAAC;QAED,eAAe,GAAG,IAAI,eAAM,CAAC,KAAK,CAAC,CAAC;QAEpC,MAAM,eAAe,CAAC,MAAM,CAAC,IAAI,EAAE;aAChC,KAAK,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;aAClD,IAAI,CAAC,MAAM,CAAC,EAAE;YACb,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC,CAAC,CAAC;QAEL,OAAO,eAAe,CAAC;IAEzB,CAAC;CAAA;AAlBD,sCAkBC;AAED,SAAgB,SAAS;IACvB,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AALD,8BAKC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processClass = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const process_method_1 = require("./process-method");
|
|
6
|
+
function processClass(options, classDeclaration) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
console.log(`====== Process class: \x1b[36m${classDeclaration.getName()}\x1b[0m`);
|
|
9
|
+
for (const methodDefinition of classDeclaration.getMethods()) {
|
|
10
|
+
yield (0, process_method_1.processMethod)(options, methodDefinition);
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
exports.processClass = processClass;
|
|
15
|
+
//# sourceMappingURL=process-class.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-class.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/process-class.ts"],"names":[],"mappings":";;;;AACA,qDAAiD;AAGjD,SAAsB,YAAY,CAChC,OAAqC,EACrC,gBAAkC;;QAGlC,OAAO,CAAC,GAAG,CAAC,iCAAkC,gBAAgB,CAAC,OAAO,EAAG,SAAS,CAAC,CAAC;QAEpF,KAAK,MAAM,gBAAgB,IAAI,gBAAgB,CAAC,UAAU,EAAE,EAAE,CAAC;YAC7D,MAAM,IAAA,8BAAa,EAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QACjD,CAAC;IAEH,CAAC;CAAA;AAXD,oCAWC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processFunction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const add_js_doc_1 = require("./add-js-doc");
|
|
6
|
+
const const_1 = require("./const");
|
|
7
|
+
const has_js_doc_1 = require("./has-js-doc");
|
|
8
|
+
const prompt_1 = require("./prompt");
|
|
9
|
+
function processFunction(options, functionDeclaration) {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
console.log(`====== Process function: \x1b[36m${functionDeclaration.getName()}\x1b[0m`);
|
|
12
|
+
if ((0, has_js_doc_1.hasJsDoc)(functionDeclaration)) {
|
|
13
|
+
console.log(`\x1b[33mFunction has already a documentation\x1b[0m`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const functionText = functionDeclaration.getText();
|
|
17
|
+
try {
|
|
18
|
+
const jsDoc = yield (0, prompt_1.prompt)(options, const_1.FUNCTION_SYSTEM_PROMPT, functionText);
|
|
19
|
+
(0, add_js_doc_1.addJsDoc)(options, functionDeclaration, jsDoc);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
console.error(`\x1b[31mError processing function: \x1b[0m${functionDeclaration.getName()}`);
|
|
23
|
+
console.error(e.message);
|
|
24
|
+
console.error(e.stack);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.processFunction = processFunction;
|
|
30
|
+
//# sourceMappingURL=process-function.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-function.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/process-function.ts"],"names":[],"mappings":";;;;AAKA,6CAAwC;AACxC,mCAAiD;AACjD,6CAAwC;AACxC,qCAAkC;AAGlC,SAAsB,eAAe,CACnC,OAAqC,EACrC,mBAAwC;;QAGxC,OAAO,CAAC,GAAG,CAAC,oCAAqC,mBAAmB,CAAC,OAAO,EAAG,SAAS,CAAC,CAAC;QAE1F,IAAI,IAAA,qBAAQ,EAAC,mBAAmB,CAAC,EAAE,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;YACnE,OAAO;QACT,CAAC;QAED,MAAM,YAAY,GAAG,mBAAmB,CAAC,OAAO,EAAE,CAAC;QAEnD,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,IAAA,eAAM,EACxB,OAAO,EACP,8BAAsB,EACtB,YAAY,CACb,CAAC;YACF,IAAA,qBAAQ,EAAC,OAAO,EAAE,mBAAmB,EAAE,KAAK,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,6CAA8C,mBAAmB,CAAC,OAAO,EAAG,EAAE,CAAC,CAAC;YAC9F,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACvB,OAAO;QACT,CAAC;IAEH,CAAC;CAAA;AA5BD,0CA4BC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processMethod = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const add_js_doc_1 = require("./add-js-doc");
|
|
6
|
+
const const_1 = require("./const");
|
|
7
|
+
const has_js_doc_1 = require("./has-js-doc");
|
|
8
|
+
const prompt_1 = require("./prompt");
|
|
9
|
+
function processMethod(options, methodDeclaration) {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
console.log(`====== Process method: \x1b[36m${methodDeclaration.getName()}\x1b[0m`);
|
|
12
|
+
if ((0, has_js_doc_1.hasJsDoc)(methodDeclaration)) {
|
|
13
|
+
console.log(`\x1b[33mMethod has already a documentation\x1b[0m`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const methodText = methodDeclaration.getText();
|
|
17
|
+
try {
|
|
18
|
+
const jsDoc = yield (0, prompt_1.prompt)(options, const_1.METHOD_SYSTEM_PROMPT, methodText);
|
|
19
|
+
(0, add_js_doc_1.addJsDoc)(options, methodDeclaration, jsDoc);
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
console.error(`\x1b[31mError processing method: \x1b[0m${methodDeclaration.getName()}`);
|
|
23
|
+
console.error(e.message);
|
|
24
|
+
console.error(e.stack);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
exports.processMethod = processMethod;
|
|
30
|
+
//# sourceMappingURL=process-method.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-method.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/process-method.ts"],"names":[],"mappings":";;;;AAKA,6CAAwC;AACxC,mCAA+C;AAC/C,6CAAwC;AACxC,qCAAkC;AAGlC,SAAsB,aAAa,CACjC,OAAqC,EACrC,iBAAoC;;QAGpC,OAAO,CAAC,GAAG,CAAC,kCAAmC,iBAAiB,CAAC,OAAO,EAAG,SAAS,CAAC,CAAC;QAEtF,IAAI,IAAA,qBAAQ,EAAC,iBAAiB,CAAC,EAAE,CAAC;YAChC,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAC;YACjE,OAAO;QACT,CAAC;QAED,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,EAAE,CAAC;QAE/C,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,MAAM,IAAA,eAAM,EACxB,OAAO,EACP,4BAAoB,EACpB,UAAU,CACX,CAAC;YAEF,IAAA,qBAAQ,EAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,CAAC,CAAC;QAC9C,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,OAAO,CAAC,KAAK,CAAC,2CAA4C,iBAAiB,CAAC,OAAO,EAAG,EAAE,CAAC,CAAC;YAC1F,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACzB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;YACvB,OAAO;QACT,CAAC;IAEH,CAAC;CAAA;AA7BD,sCA6BC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processProject = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const workspace_ts_morph_1 = require("@rxap/workspace-ts-morph");
|
|
6
|
+
const ts_morph_1 = require("@rxap/ts-morph");
|
|
7
|
+
const workspace_utilities_1 = require("@rxap/workspace-utilities");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const const_1 = require("./const");
|
|
10
|
+
const process_source_file_1 = require("./process-source-file");
|
|
11
|
+
const skip_source_file_1 = require("./skip-source-file");
|
|
12
|
+
function processProject(options, projectName, tree) {
|
|
13
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
14
|
+
const projectSourceRoot = (0, workspace_utilities_1.GetProjectSourceRoot)(tree, projectName);
|
|
15
|
+
const project = (0, ts_morph_1.CreateProject)();
|
|
16
|
+
(0, workspace_ts_morph_1.AddDir)(tree, projectSourceRoot, project);
|
|
17
|
+
const start = Date.now();
|
|
18
|
+
for (const sourceFile of project.getSourceFiles()) {
|
|
19
|
+
if ((0, skip_source_file_1.skipSourceFile)(sourceFile, options.filter)) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
try {
|
|
23
|
+
yield (0, process_source_file_1.processSourceFile)(options, sourceFile);
|
|
24
|
+
(0, workspace_utilities_1.CoerceFile)(tree, (0, path_1.join)(projectSourceRoot, sourceFile.getFilePath()), sourceFile.getFullText(), true);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
console.error(`\x1b[31mError processing file: \x1b[0m${sourceFile.getFilePath()}`);
|
|
28
|
+
console.error(e.message);
|
|
29
|
+
console.error(e.stack);
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
if (Date.now() - start > const_1.MAX_TIME) {
|
|
33
|
+
console.log(`\x1b[33mMax time reached: \x1b[0m${const_1.MAX_TIME}`);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.processProject = processProject;
|
|
40
|
+
//# sourceMappingURL=process-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-project.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/process-project.ts"],"names":[],"mappings":";;;;AACA,iEAAkD;AAClD,6CAA+C;AAC/C,mEAGmC;AACnC,+BAA4B;AAC5B,mCAAmC;AACnC,+DAA0D;AAE1D,yDAAoD;AAEpD,SAAsB,cAAc,CAAC,OAAqC,EAAE,WAAmB,EAAE,IAAU;;QAEzG,MAAM,iBAAiB,GAAG,IAAA,0CAAoB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;QAElE,MAAM,OAAO,GAAG,IAAA,wBAAa,GAAE,CAAC;QAEhC,IAAA,2BAAM,EAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,CAAC;QAEzC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAEzB,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;YAClD,IAAI,IAAA,iCAAc,EAAC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC/C,SAAS;YACX,CAAC;YACD,IAAI,CAAC;gBACH,MAAM,IAAA,uCAAiB,EAAC,OAAO,EAAE,UAAU,CAAC,CAAC;gBAC7C,IAAA,gCAAU,EAAC,IAAI,EAAE,IAAA,WAAI,EAAC,iBAAiB,EAAE,UAAU,CAAC,WAAW,EAAE,CAAC,EAAE,UAAU,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,CAAC;YACtG,CAAC;YAAC,OAAO,CAAM,EAAE,CAAC;gBAChB,OAAO,CAAC,KAAK,CAAC,yCAA0C,UAAU,CAAC,WAAW,EAAG,EAAE,CAAC,CAAC;gBACrF,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBACzB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;gBACvB,MAAM;YACR,CAAC;YACD,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,gBAAQ,EAAE,CAAC;gBAClC,OAAO,CAAC,GAAG,CAAC,oCAAqC,gBAAS,EAAE,CAAC,CAAC;gBAC9D,MAAM;YACR,CAAC;QACH,CAAC;IAEH,CAAC;CAAA;AA7BD,wCA6BC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.processSourceFile = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const process_class_1 = require("./process-class");
|
|
6
|
+
const process_function_1 = require("./process-function");
|
|
7
|
+
function processSourceFile(options, sourceFile) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
console.log(`====== Process source file: \x1b[35m${sourceFile.getFilePath()}\x1b[0m`);
|
|
10
|
+
for (const functionDeclaration of sourceFile.getFunctions()) {
|
|
11
|
+
yield (0, process_function_1.processFunction)(options, functionDeclaration);
|
|
12
|
+
}
|
|
13
|
+
for (const classDeclaration of sourceFile.getClasses()) {
|
|
14
|
+
yield (0, process_class_1.processClass)(options, classDeclaration);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
exports.processSourceFile = processSourceFile;
|
|
19
|
+
//# sourceMappingURL=process-source-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-source-file.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/process-source-file.ts"],"names":[],"mappings":";;;;AAIA,mDAA+C;AAC/C,yDAAqD;AAGrD,SAAsB,iBAAiB,CACrC,OAAqC,EACrC,UAAsB;;QAGtB,OAAO,CAAC,GAAG,CAAC,uCAAwC,UAAU,CAAC,WAAW,EAAG,SAAS,CAAC,CAAC;QAExF,KAAK,MAAM,mBAAmB,IAAI,UAAU,CAAC,YAAY,EAAE,EAAE,CAAC;YAC5D,MAAM,IAAA,kCAAe,EAAC,OAAO,EAAE,mBAAmB,CAAC,CAAC;QACtD,CAAC;QAED,KAAK,MAAM,gBAAgB,IAAI,UAAU,CAAC,UAAU,EAAE,EAAE,CAAC;YACvD,MAAM,IAAA,4BAAY,EAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAChD,CAAC;IAGH,CAAC;CAAA;AAhBD,8CAgBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function prompt(options: any, systemPrompt: string, prompt: string): Promise<string>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prompt = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const open_ai_instance_1 = require("./open-ai-instance");
|
|
6
|
+
const simple_prompt_1 = require("./simple-prompt");
|
|
7
|
+
function prompt(options, systemPrompt, prompt) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
if (options.offline) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
return (0, simple_prompt_1.SimplePrompt)(systemPrompt, prompt, (0, open_ai_instance_1.getOpenAi)());
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
exports.prompt = prompt;
|
|
16
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/prompt.ts"],"names":[],"mappings":";;;;AAAA,yDAA+C;AAC/C,mDAA+C;AAE/C,SAAsB,MAAM,CAAC,OAAO,EAAE,YAAoB,EAAE,MAAc;;QAExE,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,EAAE,CAAC;QACZ,CAAC;QAED,OAAO,IAAA,4BAAY,EACjB,YAAY,EACZ,MAAM,EACN,IAAA,4BAAS,GAAE,CACZ,CAAC;IACJ,CAAC;CAAA;AAXD,wBAWC"}
|
|
@@ -23,6 +23,14 @@
|
|
|
23
23
|
"openaiApiKey": {
|
|
24
24
|
"type": "string",
|
|
25
25
|
"description": "The openai api key"
|
|
26
|
+
},
|
|
27
|
+
"openaiOrgId": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "The openai organization id"
|
|
30
|
+
},
|
|
31
|
+
"openaiProjectId": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "The openai project id"
|
|
26
34
|
}
|
|
27
35
|
}
|
|
28
36
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { OpenAI } from 'openai';
|
|
2
|
+
import { ChatCompletionCreateParamsBase } from 'openai/resources/chat/completions';
|
|
3
|
+
export type Model = 'whisper-1' | 'dall-e-2' | 'gpt-3.5-turbo-16k' | 'tts-1-hd-1106' | 'tts-1-hd' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-0125-preview' | 'gpt-4-turbo-preview' | 'gpt-4-turbo' | 'gpt-3.5-turbo-instruct-0914' | 'gpt-4o' | 'gpt-3.5-turbo-instruct' | 'text-embedding-3-small' | 'tts-1' | 'gpt-4' | 'text-embedding-3-large' | 'gpt-4-1106-preview' | 'babbage-002' | 'gpt-4-0613' | 'gpt-3.5-turbo-0125' | 'tts-1-1106' | 'dall-e-3' | 'text-embedding-ada-002' | 'davinci-002' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'gpt-4o-2024-05-13';
|
|
4
|
+
export interface SimplePromptOptions {
|
|
3
5
|
max_tokens?: number;
|
|
4
|
-
model?:
|
|
6
|
+
model?: Model;
|
|
5
7
|
}
|
|
6
|
-
export declare function
|
|
8
|
+
export declare function IsAllDefined(options: SimplePromptOptions): options is Required<SimplePromptOptions>;
|
|
9
|
+
export declare function AssertAllDefined(options: SimplePromptOptions): asserts options is Required<SimplePromptOptions>;
|
|
10
|
+
export declare function SimplePrompt(systemPrompt: string, prompt: string, openai: OpenAI, options?: Partial<ChatCompletionCreateParamsBase>): Promise<string>;
|
|
@@ -1,23 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SimplePrompt = void 0;
|
|
3
|
+
exports.SimplePrompt = exports.AssertAllDefined = exports.IsAllDefined = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const gpt_3_encoder_1 = require("gpt-3-encoder");
|
|
6
6
|
const tokenLimits = {
|
|
7
|
+
'gpt-4-4o': 128000,
|
|
8
|
+
'gpt-4-turbo': 128000,
|
|
7
9
|
'gpt-4': 8192,
|
|
8
10
|
'gpt-3.5-turbo': 4096,
|
|
9
11
|
'gpt-3.5-turbo-16k': 16384,
|
|
10
12
|
};
|
|
13
|
+
function IsAllDefined(options) {
|
|
14
|
+
return options.max_tokens !== undefined && options.model !== undefined;
|
|
15
|
+
}
|
|
16
|
+
exports.IsAllDefined = IsAllDefined;
|
|
17
|
+
function AssertAllDefined(options) {
|
|
18
|
+
if (!IsAllDefined(options)) {
|
|
19
|
+
throw new Error(`\x1b[31mOptions are not all defined\x1b[0m`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.AssertAllDefined = AssertAllDefined;
|
|
11
23
|
function SimplePrompt(systemPrompt_1, prompt_1, openai_1) {
|
|
12
24
|
return tslib_1.__awaiter(this, arguments, void 0, function* (systemPrompt, prompt, openai, options = {
|
|
13
25
|
max_tokens: 1024,
|
|
14
|
-
model: 'gpt-4',
|
|
26
|
+
model: 'gpt-4-turbo',
|
|
15
27
|
}) {
|
|
16
28
|
var _a, _b, _c, _d;
|
|
17
29
|
const systemPromptLength = (0, gpt_3_encoder_1.encode)(systemPrompt).length;
|
|
18
30
|
const promptLength = (0, gpt_3_encoder_1.encode)(prompt).length;
|
|
19
31
|
const inputLength = Math.floor((systemPromptLength + promptLength) * 1.1);
|
|
20
|
-
(_a = options.model) !== null && _a !== void 0 ? _a : (options.model = 'gpt-
|
|
32
|
+
(_a = options.model) !== null && _a !== void 0 ? _a : (options.model = 'gpt-4o');
|
|
21
33
|
(_b = options.max_tokens) !== null && _b !== void 0 ? _b : (options.max_tokens = 1024);
|
|
22
34
|
if (!tokenLimits[options.model]) {
|
|
23
35
|
throw new Error(`\x1b[31mModel '${options.model}' is not supported.\x1b[0m`);
|
|
@@ -36,7 +48,10 @@ function SimplePrompt(systemPrompt_1, prompt_1, openai_1) {
|
|
|
36
48
|
}
|
|
37
49
|
let content;
|
|
38
50
|
try {
|
|
39
|
-
const response = yield openai.
|
|
51
|
+
const response = yield openai.chat.completions.create({
|
|
52
|
+
max_tokens: options.max_tokens,
|
|
53
|
+
model: options.model,
|
|
54
|
+
messages: [
|
|
40
55
|
{
|
|
41
56
|
'role': 'system',
|
|
42
57
|
'content': systemPrompt,
|
|
@@ -45,8 +60,13 @@ function SimplePrompt(systemPrompt_1, prompt_1, openai_1) {
|
|
|
45
60
|
'role': 'user',
|
|
46
61
|
'content': prompt,
|
|
47
62
|
},
|
|
48
|
-
],
|
|
49
|
-
|
|
63
|
+
],
|
|
64
|
+
temperature: 0,
|
|
65
|
+
top_p: 1,
|
|
66
|
+
frequency_penalty: 0,
|
|
67
|
+
presence_penalty: 0,
|
|
68
|
+
});
|
|
69
|
+
content = (_c = response.choices[0].message) === null || _c === void 0 ? void 0 : _c.content;
|
|
50
70
|
}
|
|
51
71
|
catch (e) {
|
|
52
72
|
console.log((_d = e.response) === null || _d === void 0 ? void 0 : _d.data);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-prompt.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/simple-prompt.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"simple-prompt.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/simple-prompt.ts"],"names":[],"mappings":";;;;AAAA,iDAAuC;AAIvC,MAAM,WAAW,GAAG;IAClB,UAAU,EAAE,MAAO;IACnB,aAAa,EAAE,MAAO;IACtB,OAAO,EAAE,IAAI;IACb,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,KAAK;CAC3B,CAAC;AASF,SAAgB,YAAY,CAAC,OAA4B;IACvD,OAAO,OAAO,CAAC,UAAU,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC;AACzE,CAAC;AAFD,oCAEC;AAED,SAAgB,gBAAgB,CAAC,OAA4B;IAC3D,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAJD,4CAIC;AAED,SAAsB,YAAY;iEAChC,YAAoB,EACpB,MAAc,EACd,MAAc,EACd,UAAmD;QACjD,UAAU,EAAE,IAAI;QAChB,KAAK,EAAE,aAAa;KACrB;;QAGD,MAAM,kBAAkB,GAAG,IAAA,sBAAM,EAAC,YAAY,CAAC,CAAC,MAAM,CAAC;QACvD,MAAM,YAAY,GAAG,IAAA,sBAAM,EAAC,MAAM,CAAC,CAAC,MAAM,CAAC;QAE3C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,kBAAkB,GAAG,YAAY,CAAC,GAAG,GAAG,CAAC,CAAC;QAE1E,MAAA,OAAO,CAAC,KAAK,oCAAb,OAAO,CAAC,KAAK,GAAK,QAAQ,EAAC;QAC3B,MAAA,OAAO,CAAC,U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AC,CAAC,CAAC,CAAC,OAAO,0CAAE,OAAO,CAAC;QAEjD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,GAAG,CAAC,MAAA,CAAC,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAC;YAC9B,MAAM,IAAI,KAAK,CAAC,oBAAoB,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC;QACpD,CAAC;QAED,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QAED,OAAO,OAAO,CAAC;IAEjB,CAAC;CAAA;AAxED,oCAwEC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.skipSourceFile = void 0;
|
|
4
|
+
function skipSourceFile(sourceFile, filter) {
|
|
5
|
+
if (sourceFile.getBaseName() === 'index.ts') {
|
|
6
|
+
// console.log(`\x1b[33mSkip index file: \x1b[0m${ sourceFile.getFilePath() }`);
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
if (sourceFile.getBaseName().endsWith('.spec.ts')) {
|
|
10
|
+
// console.log(`\x1b[33mSkip spec file: \x1b[0m${ sourceFile.getFilePath() }`);
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
if (sourceFile.getBaseName().endsWith('.stories.ts')) {
|
|
14
|
+
// console.log(`\x1b[33mSkip stories file: \x1b[0m${ sourceFile.getFilePath() }`);
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (sourceFile.getBaseName().endsWith('.cy.ts')) {
|
|
18
|
+
// console.log(`\x1b[33mSkip cypress file: \x1b[0m${ sourceFile.getFilePath() }`);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
if (filter) {
|
|
22
|
+
if (!sourceFile.getFilePath().includes(filter)) {
|
|
23
|
+
// console.log(`\x1b[33mSkip file: \x1b[0m${ sourceFile.getFilePath() }`);
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
exports.skipSourceFile = skipSourceFile;
|
|
30
|
+
//# sourceMappingURL=skip-source-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skip-source-file.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/documentation/skip-source-file.ts"],"names":[],"mappings":";;;AAEA,SAAgB,cAAc,CAAC,UAAsB,EAAE,MAAe;IACpE,IAAI,UAAU,CAAC,WAAW,EAAE,KAAK,UAAU,EAAE,CAAC;QAC5C,gFAAgF;QAChF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QAClD,+EAA+E;QAC/E,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QACrD,kFAAkF;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChD,kFAAkF;QAClF,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,MAAM,EAAE,CAAC;QACX,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/C,0EAA0E;YAC1E,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAxBD,wCAwBC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
You are an assistant designed to generate comprehensive JSDoc comments for TypeScript classes. Your task is to take the full implementation of a TypeScript class and produce a detailed JSDoc comment for the class itself in Markdown format. The generated comment should provide a complete understanding of the class's purpose, usage, and any important details about its properties and methods. The comment should enhance readability and comprehension for anyone reading it. Ensure that the output is strictly the content of the comment without any extra formatting characters such as leading asterisks.
|
|
2
|
+
|
|
3
|
+
Here is what you need to do:
|
|
4
|
+
|
|
5
|
+
1. Analyze the given TypeScript class to understand its structure and functionality.
|
|
6
|
+
2. Create a JSDoc comment for the class that includes:
|
|
7
|
+
- A comprehensive description of the class's purpose and behavior.
|
|
8
|
+
- Examples of how to use the class (`@example`). Ensure the example code is correctly indented.
|
|
9
|
+
- A concise summary of what the class does (`@summary <description>`).
|
|
10
|
+
3. Ensure the comment is written in clear and concise English.
|
|
11
|
+
4. Format the comment in Markdown for improved readability.
|
|
12
|
+
5. Output only the content of the comment.
|
|
13
|
+
|
|
14
|
+
**Example Output:**
|
|
15
|
+
------------------------------------------------------------------------------------------------------------------------
|
|
16
|
+
This class provides basic arithmetic operations such as addition, subtraction, multiplication, and division. It ensures
|
|
17
|
+
that inputs are valid numbers and throws errors for invalid operations. This class can be used in various applications
|
|
18
|
+
where basic arithmetic operations are needed.
|
|
19
|
+
|
|
20
|
+
@example
|
|
21
|
+
```typescript
|
|
22
|
+
const calculator = new Calculator();
|
|
23
|
+
calculator.add(2, 3);
|
|
24
|
+
console.log(calculator.result); // Outputs: 5
|
|
25
|
+
calculator.subtract(2);
|
|
26
|
+
console.log(calculator.result); // Outputs: 3
|
|
27
|
+
calculator.multiply(4);
|
|
28
|
+
console.log(calculator.result); // Outputs: 12
|
|
29
|
+
calculator.divide(3);
|
|
30
|
+
console.log(calculator.result); // Outputs: 4
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
@summary A simple calculator class.
|
|
34
|
+
------------------------------------------------------------------------------------------------------------------------
|
|
35
|
+
|
|
36
|
+
Please provide the JSDoc comment for the following TypeScript class implementation:
|
|
@@ -1 +1,39 @@
|
|
|
1
|
-
You
|
|
1
|
+
You are an assistant designed to generate comprehensive JSDoc comments for TypeScript functions. Your task is to take the implementation of a TypeScript function and produce a detailed JSDoc comment in Markdown format. The generated comment should provide a complete understanding of the function's purpose, usage, possible edge cases, handled and unhandled scenarios, and any potential errors that might be thrown. The comment should enhance readability and comprehension for anyone reading it. Do not include type annotations for parameters or return values since TypeScript already handles that. Ensure that the output is strictly the content of the comment without any extra formatting characters such as leading asterisks.
|
|
2
|
+
|
|
3
|
+
Here is what you need to do:
|
|
4
|
+
|
|
5
|
+
1. Analyze the given TypeScript function to understand its functionality.
|
|
6
|
+
2. Create a JSDoc comment that includes:
|
|
7
|
+
- A comprehensive description of the function's purpose and behavior.
|
|
8
|
+
- Detailed explanations for each parameter (`@param <name> - <description>`).
|
|
9
|
+
- A description of the return value (`@returns <description>`).
|
|
10
|
+
- Information on any possible errors that might be thrown (`@throws <description>`).
|
|
11
|
+
- Notes on any edge cases handled or unhandled by the function.
|
|
12
|
+
- Examples of how to use the function (`@example`). Ensure the example code is correctly indented.
|
|
13
|
+
- A concise summary of what the function does (`@summary <description>`).
|
|
14
|
+
|
|
15
|
+
3. Ensure the comment is written in clear and concise English.
|
|
16
|
+
4. Format the comment in Markdown for improved readability.
|
|
17
|
+
5. Output only the content of the comment.
|
|
18
|
+
|
|
19
|
+
**Example Output:**
|
|
20
|
+
------------------------------------------------------------------------------------------------------------------------
|
|
21
|
+
This function takes two numeric inputs and returns their sum. It ensures that both inputs are numbers and throws an
|
|
22
|
+
error if either input is not a number. This function does not handle cases where the inputs are not finite numbers.
|
|
23
|
+
|
|
24
|
+
@param num1 - The first number to add.
|
|
25
|
+
@param num2 - The second number to add.
|
|
26
|
+
@returns The sum of the two numbers.
|
|
27
|
+
@throws Will throw an error if the inputs are not numbers.
|
|
28
|
+
Note: This function does not handle cases where the inputs are not finite numbers.
|
|
29
|
+
|
|
30
|
+
@example
|
|
31
|
+
```typescript
|
|
32
|
+
const result = add(2, 3);
|
|
33
|
+
console.log(result); // Outputs: 5
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
@summary Adds two numbers together.
|
|
37
|
+
------------------------------------------------------------------------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
Please provide the JSDoc comment for the following TypeScript function implementation:
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
You are an assistant designed to generate comprehensive JSDoc comments for methods within TypeScript classes. Your task is to take the full implementation of a TypeScript class and a specific method name, then produce a detailed JSDoc comment for that method in Markdown format. The generated comment should provide a complete understanding of the method's purpose, usage, possible edge cases, handled and unhandled scenarios, and any potential errors that might be thrown. The comment should enhance readability and comprehension for anyone reading it. Do not include type annotations for parameters or return values since TypeScript already handles that. Ensure that the output is strictly the content of the comment without any extra formatting characters such as leading asterisks.
|
|
2
|
+
|
|
3
|
+
Here is what you need to do:
|
|
4
|
+
|
|
5
|
+
1. Analyze the given TypeScript class to understand its structure and functionality.
|
|
6
|
+
2. Focus on the specified method within the class to understand its functionality.
|
|
7
|
+
3. Create a JSDoc comment for the method that includes:
|
|
8
|
+
- A comprehensive description of the method's purpose and behavior within the context of the class.
|
|
9
|
+
- Detailed explanations for each parameter (`@param <name> - <description>`).
|
|
10
|
+
- A description of the return value (`@returns <description>`).
|
|
11
|
+
- Information on any possible errors that might be thrown (`@throws <description>`).
|
|
12
|
+
- Notes on any edge cases handled or unhandled by the method.
|
|
13
|
+
- Examples of how to use the method within the class context (`@example`). Ensure the example code is correctly indented.
|
|
14
|
+
- A concise summary of what the method does (`@summary <description>`).
|
|
15
|
+
|
|
16
|
+
4. Ensure the comment is written in clear and concise English.
|
|
17
|
+
5. Format the comment in Markdown for improved readability.
|
|
18
|
+
6. Output only the content of the comment.
|
|
19
|
+
|
|
20
|
+
**Example Output:**
|
|
21
|
+
------------------------------------------------------------------------------------------------------------------------
|
|
22
|
+
This method takes two numeric inputs and returns their sum. It ensures that both inputs are numbers and throws an error
|
|
23
|
+
if either input is not a number. This method does not handle cases where the inputs are not finite numbers.
|
|
24
|
+
|
|
25
|
+
@param num1 - The first number to add.
|
|
26
|
+
@param num2 - The second number to add.
|
|
27
|
+
@returns The sum of the two numbers.
|
|
28
|
+
@throws Will throw an error if the inputs are not numbers.
|
|
29
|
+
Note: This method does not handle cases where the inputs are not finite numbers.
|
|
30
|
+
|
|
31
|
+
@example
|
|
32
|
+
```typescript
|
|
33
|
+
const calculator = new Calculator();
|
|
34
|
+
const result = calculator.add(2, 3);
|
|
35
|
+
console.log(result); // Outputs: 5
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
@summary Adds two numbers together.
|
|
39
|
+
------------------------------------------------------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
Please provide the JSDoc comment for the following TypeScript class and method:
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initGenerator = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
function initGenerator(tree, options) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
var _a, _b, _c, _d, _e;
|
|
10
|
+
const packageJsonFilePath = (0, path_1.relative)(tree.root, (0, path_1.join)(__dirname, '..', '..', '..', 'package.json'));
|
|
11
|
+
if (!tree.exists(packageJsonFilePath)) {
|
|
12
|
+
console.error('package.json not found in: ' + packageJsonFilePath);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const { peerDependencies, name: packageName } = JSON.parse(tree.read(packageJsonFilePath, 'utf-8'));
|
|
16
|
+
console.log(`Coerce peer dependencies for package: ${packageName}`);
|
|
17
|
+
if (!peerDependencies || !Object.keys(peerDependencies).length) {
|
|
18
|
+
console.log('No peer dependencies found');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
console.log(`Peer dependencies: ${Object.keys(peerDependencies).join(', ')}`);
|
|
22
|
+
const rootPackageJson = JSON.parse(tree.read('package.json', 'utf-8'));
|
|
23
|
+
let isDevDependency = !!((_a = rootPackageJson.devDependencies) === null || _a === void 0 ? void 0 : _a[packageName]);
|
|
24
|
+
if (isDevDependency &&
|
|
25
|
+
[/^@rxap\/ngx/, /^@rxap\/nest/].some((rx) => rx.test(packageName))) {
|
|
26
|
+
(_b = rootPackageJson.dependencies) !== null && _b !== void 0 ? _b : (rootPackageJson.dependencies = {});
|
|
27
|
+
rootPackageJson.dependencies[packageName] =
|
|
28
|
+
rootPackageJson.devDependencies[packageName];
|
|
29
|
+
delete rootPackageJson.devDependencies[packageName];
|
|
30
|
+
isDevDependency = false;
|
|
31
|
+
tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
|
|
32
|
+
}
|
|
33
|
+
if (!isDevDependency && [
|
|
34
|
+
/^@rxap\/plugin/,
|
|
35
|
+
/^@rxap\/workspace/,
|
|
36
|
+
/@rxap\/schematic/,
|
|
37
|
+
]) {
|
|
38
|
+
(_c = rootPackageJson.devDependencies) !== null && _c !== void 0 ? _c : (rootPackageJson.devDependencies = {});
|
|
39
|
+
rootPackageJson.devDependencies[packageName] =
|
|
40
|
+
rootPackageJson.dependencies[packageName];
|
|
41
|
+
delete rootPackageJson.dependencies[packageName];
|
|
42
|
+
isDevDependency = true;
|
|
43
|
+
tree.write('package.json', JSON.stringify(rootPackageJson, null, 2));
|
|
44
|
+
}
|
|
45
|
+
const missingPeerDependencies = Object.entries(peerDependencies)
|
|
46
|
+
.filter(([dep]) => {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
return !((_a = rootPackageJson.dependencies) === null || _a === void 0 ? void 0 : _a[dep]) &&
|
|
49
|
+
!((_b = rootPackageJson.devDependencies) === null || _b === void 0 ? void 0 : _b[dep]);
|
|
50
|
+
})
|
|
51
|
+
.reduce((acc, [dep, version]) => (Object.assign(Object.assign({}, acc), { [dep]: version })), {});
|
|
52
|
+
if (!Object.keys(missingPeerDependencies).length) {
|
|
53
|
+
console.log('No missing peer dependencies');
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (isDevDependency) {
|
|
57
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, missingPeerDependencies);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, missingPeerDependencies, {});
|
|
61
|
+
}
|
|
62
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
63
|
+
(0, devkit_1.installPackagesTask)(tree);
|
|
64
|
+
for (const peer of Object.keys(missingPeerDependencies)) {
|
|
65
|
+
console.log(`Peer dependency ${peer} added to package.json`);
|
|
66
|
+
const peerPackageJsonFilePath = (0, path_1.join)('node_modules', ...peer.split('/'), 'package.json');
|
|
67
|
+
if (!tree.exists(peerPackageJsonFilePath)) {
|
|
68
|
+
console.log(`Peer dependency ${peer} has no package.json`);
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const { generators, schematics } = JSON.parse(tree.read(peerPackageJsonFilePath, 'utf-8'));
|
|
72
|
+
if (!generators && !schematics) {
|
|
73
|
+
console.log(`Peer dependency ${peer} has no generators or schematics`);
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
const configFile = generators || schematics;
|
|
77
|
+
if (!tree.exists((0, path_1.join)('node_modules', ...peer.split('/'), configFile))) {
|
|
78
|
+
console.log(`Peer dependency ${peer} has no generators or schematics file`);
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const config = JSON.parse(tree.read((0, path_1.join)('node_modules', ...peer.split('/'), configFile), 'utf-8'));
|
|
82
|
+
if (!((_d = config.generators) === null || _d === void 0 ? void 0 : _d.init)) {
|
|
83
|
+
console.log(`Peer dependency ${peer} has no init generator`);
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
const initGeneratorFilePath = config.generators.init.factory;
|
|
87
|
+
const fullInitGeneratorFilePath = (0, path_1.join)('node_modules', ...peer.split('/'), initGeneratorFilePath) + '.js';
|
|
88
|
+
if (!tree.exists(fullInitGeneratorFilePath)) {
|
|
89
|
+
console.log(`Peer dependency ${peer} has no init generator file: ` +
|
|
90
|
+
fullInitGeneratorFilePath);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
94
|
+
const initGenerator = (_e = require((0, path_1.join)('node_modules', ...peer.split('/'), initGeneratorFilePath))) === null || _e === void 0 ? void 0 : _e.default;
|
|
95
|
+
if (typeof initGenerator !== 'function') {
|
|
96
|
+
console.log(`Peer dependency ${peer} has no init generator function`);
|
|
97
|
+
continue;
|
|
98
|
+
}
|
|
99
|
+
console.log(`Run init generator for peer dependency ${peer}`);
|
|
100
|
+
yield initGenerator(tree, options);
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
exports.initGenerator = initGenerator;
|
|
105
|
+
exports.default = initGenerator;
|
|
106
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../../../packages/plugin/gpt/src/generators/init/generator.ts"],"names":[],"mappings":";;;;AAAA,uCAKoB;AACpB,+BAAsC;AAGtC,SAAsB,aAAa,CAAC,IAAU,EAAE,OAA4B;;;QAC1E,MAAM,mBAAmB,GAAG,IAAA,eAAQ,EAClC,IAAI,CAAC,IAAI,EACT,IAAA,WAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,CAClD,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,CAAC;YACtC,OAAO,CAAC,KAAK,CAAC,6BAA6B,GAAG,mBAAmB,CAAC,CAAC;YACnE,OAAO;QACT,CAAC;QACD,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CACxD,IAAI,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAE,CACzC,CAAC;QAEF,OAAO,CAAC,GAAG,CAAC,yCAAyC,WAAW,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