fix(core): update

This commit is contained in:
Philipp Kunz 2024-05-17 17:38:35 +02:00
parent be53225bb1
commit 32f12c67cf
6 changed files with 4910 additions and 2946 deletions

View File

@ -17,24 +17,24 @@
"build": "(tsbuild --web --allowimplicitany)" "build": "(tsbuild --web --allowimplicitany)"
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.1.65", "@git.zone/tsbuild": "^2.1.76",
"@git.zone/tsrun": "^1.2.46", "@git.zone/tsrun": "^1.2.46",
"@git.zone/tstest": "^1.0.90", "@git.zone/tstest": "^1.0.90",
"@push.rocks/tapbundle": "^5.0.23", "@push.rocks/tapbundle": "^5.0.23",
"@types/node": "^20.12.7" "@types/node": "^20.12.12"
}, },
"dependencies": { "dependencies": {
"@push.rocks/early": "^4.0.3", "@push.rocks/early": "^4.0.3",
"@push.rocks/npmextra": "^5.0.13", "@push.rocks/npmextra": "^5.0.13",
"@push.rocks/qenv": "^6.0.5", "@push.rocks/qenv": "^6.0.5",
"@push.rocks/smartai": "^0.0.8", "@push.rocks/smartai": "^0.0.17",
"@push.rocks/smartcli": "^4.0.10", "@push.rocks/smartcli": "^4.0.10",
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartfile": "^11.0.14", "@push.rocks/smartfile": "^11.0.14",
"@push.rocks/smartinteract": "^2.0.15", "@push.rocks/smartinteract": "^2.0.15",
"@push.rocks/smartlog": "^3.0.1", "@push.rocks/smartlog": "^3.0.1",
"@push.rocks/smartlog-destination-local": "^9.0.1", "@push.rocks/smartlog-destination-local": "^9.0.2",
"@push.rocks/smartpath": "^5.0.16", "@push.rocks/smartpath": "^5.0.18",
"@push.rocks/smartshell": "^3.0.5", "@push.rocks/smartshell": "^3.0.5",
"typedoc": "^0.25.13", "typedoc": "^0.25.13",
"typescript": "^5.4.5" "typescript": "^5.4.5"

7684
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/tsdoc', name: '@git.zone/tsdoc',
version: '1.1.27', version: '1.1.28',
description: 'An advanced TypeScript documentation tool using AI to generate and enhance documentation for TypeScript projects.' description: 'An advanced TypeScript documentation tool using AI to generate and enhance documentation for TypeScript projects.'
} }

View File

@ -8,7 +8,6 @@ interface IDescriptionInterface {
} }
export class Description { export class Description {
// INSTANCE // INSTANCE
private aiDocsRef: AiDoc; private aiDocsRef: AiDoc;
private projectDir: string; private projectDir: string;
@ -23,8 +22,8 @@ export class Description {
const projectContext = new ProjectContext(this.projectDir); const projectContext = new ProjectContext(this.projectDir);
const contextString = await projectContext.update(); const contextString = await projectContext.update();
let result = await this.aiDocsRef.openaiInstance.chat( let result = await this.aiDocsRef.openaiInstance.chat({
` systemMessage: `
You create a json adhering the following interface: You create a json adhering the following interface:
{ {
description: string; // a sensible short, one sentence description of the project description: string; // a sensible short, one sentence description of the project
@ -40,12 +39,14 @@ export class Description {
Don't wrap the JSON in three ticks json!!! Don't wrap the JSON in three ticks json!!!
`, `,
contextString, messageHistory: [],
[] userMessage: contextString,
); });
console.log(result.message.content); console.log(result.message);
const resultObject: IDescriptionInterface = JSON.parse(result.message.content.replace('```json', '').replace('```', '')); const resultObject: IDescriptionInterface = JSON.parse(
result.message.replace('```json', '').replace('```', '')
);
const npmextraJson = (await projectContext.gatherFiles()).smartfilesNpmextraJSON; const npmextraJson = (await projectContext.gatherFiles()).smartfilesNpmextraJSON;
const npmextraJsonContent = JSON.parse(npmextraJson.contents.toString()); const npmextraJsonContent = JSON.parse(npmextraJson.contents.toString());
@ -64,10 +65,9 @@ export class Description {
packageJson.contents = Buffer.from(JSON.stringify(packageJsonContent, null, 2)); packageJson.contents = Buffer.from(JSON.stringify(packageJsonContent, null, 2));
await packageJson.write(); await packageJson.write();
console.log(`\n======================\n`); console.log(`\n======================\n`);
console.log(JSON.stringify(resultObject, null, 2)); console.log(JSON.stringify(resultObject, null, 2));
console.log(`\n======================\n`); console.log(`\n======================\n`);
return result.message.content; return result.message;
} }
} }

View File

@ -28,8 +28,8 @@ export class Readme {
console.log(error); console.log(error);
} }
let result = await this.aiDocsRef.openaiInstance.chat( let result = await this.aiDocsRef.openaiInstance.chat({
` systemMessage: `
You create markdown readmes for npm projects. You only output the markdown readme. You create markdown readmes for npm projects. You only output the markdown readme.
The Readme should follow the following template: The Readme should follow the following template:
@ -64,23 +64,23 @@ The Readme should follow the following template:
* readme.hints.md provides valuable hints about module ideas. * readme.hints.md provides valuable hints about module ideas.
] ]
`, `,
contextString, messageHistory: [],
[] userMessage: contextString,
); });
finalReadmeString += result.message.content + '\n' + legalInfo; finalReadmeString += result.message + '\n' + legalInfo;
console.log(`\n======================\n`); console.log(`\n======================\n`);
console.log(result.message.content); console.log(result.message);
console.log(`\n======================\n`); console.log(`\n======================\n`);
const readme = (await projectContext.gatherFiles()).smartfilesReadme; const readme = (await projectContext.gatherFiles()).smartfilesReadme;
readme.contents = Buffer.from(finalReadmeString); readme.contents = Buffer.from(finalReadmeString);
await readme.write(); await readme.write();
return result.message.content; return result.message;
} }
} }

View File

@ -69,7 +69,9 @@ export class AiDoc {
} }
// lets assume we have an OPENAI_Token now // lets assume we have an OPENAI_Token now
this.openaiInstance = new plugins.smartai.OpenAiProvider(this.openaiToken); this.openaiInstance = new plugins.smartai.OpenAiProvider({
openaiToken: this.openaiToken,
});
await this.openaiInstance.start(); await this.openaiInstance.start();
} }