import * as plugins from './tsdoc.plugins.js'; export class AiDocs { private openaiToken: string; public npmextraKV: plugins.npmextra.KeyValueStore; public qenvInstance: plugins.qenv.Qenv; public smartinteractInstance: plugins.smartinteract.SmartInteract; public openaiInstance: plugins.smartai.OpenAiProvider; constructor() {} public async start() { // lets care about prerequisites this.smartinteractInstance = new plugins.smartinteract.SmartInteract(); this.qenvInstance = new plugins.qenv.Qenv() if (!(await this.qenvInstance.getEnvVarOnDemand('OPENAI_TOKEN'))) { this.npmextraKV = new plugins.npmextra.KeyValueStore({ typeArg: 'userHomeDir', identityArg: 'tsdoc', mandatoryKeys: ['OPENAI_TOKEN'] }); const missingKeys = this.npmextraKV.getMissingMandatoryKeys(); if (missingKeys.length > 0) { const answerObject = await this.smartinteractInstance.askQuestion({ type: 'input', message: `Please provide your OpenAI token`, name: 'OPENAI_TOKEN', default: '', }); this.openaiToken = answerObject.value await this.npmextraKV.writeKey('OPENAI_TOKEN', this.openaiToken); } } // lets assume we have an OPENAI_Token now // we can now assemble the directory structure. const smartfilesMod = plugins.smartfile.fs.fileTreeToObject(process.cwd(), 'ts/**/*.ts'); const smartfilesTest = plugins.smartfile.fs.fileTreeToObject(process.cwd(), 'test/**/*.ts'); console.log(smartfilesMod); console.log(smartfilesTest); } }