fix(core): update
This commit is contained in:
parent
be53225bb1
commit
32f12c67cf
10
package.json
10
package.json
@ -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"
|
||||||
|
7776
pnpm-lock.yaml
generated
7776
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -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.'
|
||||||
}
|
}
|
||||||
|
@ -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,30 +22,32 @@ 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
|
||||||
keywords: string[]; // an array of tags that describe the project
|
keywords: string[]; // an array of tags that describe the project
|
||||||
}
|
}
|
||||||
|
|
||||||
The description should be based on what you understand from the project's files.
|
The description should be based on what you understand from the project's files.
|
||||||
The keywords should be based on use cases you see from the files.
|
The keywords should be based on use cases you see from the files.
|
||||||
Don't be cheap about the way you think.
|
Don't be cheap about the way you think.
|
||||||
|
|
||||||
Important: Answer only in valid JSON.
|
Important: Answer only in valid JSON.
|
||||||
You answer should be parseable with JSON.parse() without modifying anything.
|
You answer should be parseable with JSON.parse() without modifying anything.
|
||||||
|
|
||||||
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);
|
||||||
|
const resultObject: IDescriptionInterface = JSON.parse(
|
||||||
|
result.message.replace('```json', '').replace('```', '')
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(result.message.content);
|
|
||||||
const resultObject: IDescriptionInterface = JSON.parse(result.message.content.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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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:
|
||||||
@ -63,24 +63,24 @@ The Readme should follow the following template:
|
|||||||
* npmextra.json contains overall module information.
|
* npmextra.json contains overall module information.
|
||||||
* 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user