fix(aidocs): correct smartconfig file handling and tighten TypeScript typings
This commit is contained in:
@@ -1,5 +1,13 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-05-09 - 2.0.4 - fix(aidocs)
|
||||||
|
correct smartconfig file handling and tighten TypeScript typings
|
||||||
|
|
||||||
|
- rename internal project context references from npmextra JSON to .smartconfig.json
|
||||||
|
- fix README and description flows to read the correct smartconfig file
|
||||||
|
- allow missing changelog and initialize AI doc properties safely
|
||||||
|
- add explicit TypeScript annotations in typedoc and refresh package dependencies
|
||||||
|
|
||||||
## 2026-04-30 - 2.0.3 - fix(scripts)
|
## 2026-04-30 - 2.0.3 - fix(scripts)
|
||||||
update test and build scripts for pnpm usage and stricter tsbuild defaults
|
update test and build scripts for pnpm usage and stricter tsbuild defaults
|
||||||
|
|
||||||
|
|||||||
+19
-17
@@ -19,31 +19,33 @@
|
|||||||
"buildDocs": "tsdoc"
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsbuild": "^4.3.0",
|
"@git.zone/tsbuild": "^4.4.0",
|
||||||
"@git.zone/tsrun": "^2.0.1",
|
"@git.zone/tsrun": "^2.0.3",
|
||||||
"@git.zone/tstest": "^3.5.1",
|
"@git.zone/tstest": "^3.6.5",
|
||||||
"@types/node": "^25.5.0"
|
"@types/json-schema": "^7.0.15",
|
||||||
|
"@types/node": "^25.6.2",
|
||||||
|
"@types/yargs-parser": "^21.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@git.zone/tspublish": "^1.11.3",
|
"@git.zone/tspublish": "^1.11.6",
|
||||||
"@push.rocks/early": "^4.0.4",
|
"@push.rocks/early": "^4.0.4",
|
||||||
"@push.rocks/smartconfig": "^6.0.1",
|
"@push.rocks/qenv": "^6.1.4",
|
||||||
"@push.rocks/qenv": "^6.1.3",
|
"@push.rocks/smartagent": "^3.1.0",
|
||||||
"@push.rocks/smartagent": "^3.0.2",
|
"@push.rocks/smartai": "^2.2.0",
|
||||||
"@push.rocks/smartai": "^2.0.0",
|
"@push.rocks/smartcli": "^4.0.21",
|
||||||
"@push.rocks/smartcli": "^4.0.20",
|
"@push.rocks/smartconfig": "^6.1.1",
|
||||||
"@push.rocks/smartdelay": "^3.0.5",
|
"@push.rocks/smartdelay": "^3.1.0",
|
||||||
"@push.rocks/smartfile": "^13.1.2",
|
"@push.rocks/smartfile": "^13.1.3",
|
||||||
"@push.rocks/smartfs": "^1.5.0",
|
"@push.rocks/smartfs": "^1.5.1",
|
||||||
"@push.rocks/smartgit": "^3.3.1",
|
"@push.rocks/smartgit": "^3.3.2",
|
||||||
"@push.rocks/smartinteract": "^2.0.16",
|
"@push.rocks/smartinteract": "^2.0.16",
|
||||||
"@push.rocks/smartlog": "^3.2.1",
|
"@push.rocks/smartlog": "^3.2.2",
|
||||||
"@push.rocks/smartlog-destination-local": "^9.0.2",
|
"@push.rocks/smartlog-destination-local": "^9.0.2",
|
||||||
"@push.rocks/smartpath": "^6.0.0",
|
"@push.rocks/smartpath": "^6.0.0",
|
||||||
"@push.rocks/smartshell": "^3.3.8",
|
"@push.rocks/smartshell": "^3.3.8",
|
||||||
"@push.rocks/smarttime": "^4.2.3",
|
"@push.rocks/smarttime": "^4.2.3",
|
||||||
"typedoc": "^0.28.18",
|
"typedoc": "^0.28.19",
|
||||||
"typescript": "^6.0.2"
|
"typescript": "^6.0.3"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
|||||||
Generated
+980
-846
File diff suppressed because it is too large
Load Diff
@@ -12,8 +12,8 @@ For reporting bugs, issues, or security vulnerabilities, please visit [community
|
|||||||
# Global installation (recommended for CLI usage)
|
# Global installation (recommended for CLI usage)
|
||||||
pnpm add -g @git.zone/tsdoc
|
pnpm add -g @git.zone/tsdoc
|
||||||
|
|
||||||
# Or use with npx (no install needed)
|
# Or run without installing globally
|
||||||
npx @git.zone/tsdoc
|
pnpm dlx @git.zone/tsdoc
|
||||||
|
|
||||||
# Or install locally as a project dependency
|
# Or install locally as a project dependency
|
||||||
pnpm add @git.zone/tsdoc
|
pnpm add @git.zone/tsdoc
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@git.zone/tsdoc',
|
name: '@git.zone/tsdoc',
|
||||||
version: '2.0.3',
|
version: '2.0.4',
|
||||||
description: 'A comprehensive TypeScript documentation tool that leverages AI to generate and enhance project documentation, including dynamic README creation, API docs via TypeDoc, and smart commit message generation.'
|
description: 'A comprehensive TypeScript documentation tool that leverages AI to generate and enhance project documentation, including dynamic README creation, API docs via TypeDoc, and smart commit message generation.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ Analyze these changes and output the JSON commit message object.
|
|||||||
const resultObject: INextCommitObject = JSON.parse(jsonString);
|
const resultObject: INextCommitObject = JSON.parse(jsonString);
|
||||||
|
|
||||||
const previousChangelogPath = plugins.path.join(this.projectDir, 'changelog.md');
|
const previousChangelogPath = plugins.path.join(this.projectDir, 'changelog.md');
|
||||||
let previousChangelog: plugins.smartfile.SmartFile;
|
let previousChangelog: plugins.smartfile.SmartFile | undefined;
|
||||||
if (await plugins.fsInstance.file(previousChangelogPath).exists()) {
|
if (await plugins.fsInstance.file(previousChangelogPath).exists()) {
|
||||||
previousChangelog = await plugins.smartfileFactory.fromFilePath(previousChangelogPath);
|
previousChangelog = await plugins.smartfileFactory.fromFilePath(previousChangelogPath);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ Don't wrap the JSON in \`\`\`json\`\`\` - just return the raw JSON object.
|
|||||||
const files = await projectContext.gatherFiles();
|
const files = await projectContext.gatherFiles();
|
||||||
|
|
||||||
// Update smartconfig.json
|
// Update smartconfig.json
|
||||||
const smartconfigJson = files.smartfilesNpmextraJSON;
|
const smartconfigJson = files.smartfilesSmartconfigJSON;
|
||||||
const smartconfigJsonContent = JSON.parse(smartconfigJson.contents.toString());
|
const smartconfigJsonContent = JSON.parse(smartconfigJson.contents.toString());
|
||||||
|
|
||||||
smartconfigJsonContent['gitzone'].module.description = resultObject.description;
|
smartconfigJsonContent['gitzone'].module.description = resultObject.description;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export class ProjectContext {
|
|||||||
plugins.path.join(this.projectDir, 'readme.hints.md'),
|
plugins.path.join(this.projectDir, 'readme.hints.md'),
|
||||||
this.projectDir,
|
this.projectDir,
|
||||||
);
|
);
|
||||||
const smartfilesNpmextraJSON = await plugins.smartfileFactory.fromFilePath(
|
const smartfilesSmartconfigJSON = await plugins.smartfileFactory.fromFilePath(
|
||||||
plugins.path.join(this.projectDir, '.smartconfig.json'),
|
plugins.path.join(this.projectDir, '.smartconfig.json'),
|
||||||
this.projectDir,
|
this.projectDir,
|
||||||
);
|
);
|
||||||
@@ -40,7 +40,7 @@ export class ProjectContext {
|
|||||||
smartfilePackageJSON,
|
smartfilePackageJSON,
|
||||||
smartfilesReadme,
|
smartfilesReadme,
|
||||||
smartfilesReadmeHints,
|
smartfilesReadmeHints,
|
||||||
smartfilesNpmextraJSON,
|
smartfilesSmartconfigJSON,
|
||||||
smartfilesMod,
|
smartfilesMod,
|
||||||
smartfilesTest,
|
smartfilesTest,
|
||||||
};
|
};
|
||||||
@@ -80,7 +80,7 @@ ${smartfile.contents.toString()}
|
|||||||
files.smartfilePackageJSON,
|
files.smartfilePackageJSON,
|
||||||
files.smartfilesReadme,
|
files.smartfilesReadme,
|
||||||
files.smartfilesReadmeHints,
|
files.smartfilesReadmeHints,
|
||||||
files.smartfilesNpmextraJSON,
|
files.smartfilesSmartconfigJSON,
|
||||||
...files.smartfilesMod,
|
...files.smartfilesMod,
|
||||||
...files.smartfilesTest,
|
...files.smartfilesTest,
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export class Readme {
|
|||||||
// First check legal info before introducing any cost
|
// First check legal info before introducing any cost
|
||||||
const projectContext = new ProjectContext(this.projectDir);
|
const projectContext = new ProjectContext(this.projectDir);
|
||||||
const smartconfigJson = JSON.parse(
|
const smartconfigJson = JSON.parse(
|
||||||
(await projectContext.gatherFiles()).smartfilesNpmextraJSON.contents.toString()
|
(await projectContext.gatherFiles()).smartfilesSmartconfigJSON.contents.toString()
|
||||||
);
|
);
|
||||||
const legalInfo = smartconfigJson?.['tsdoc']?.legal;
|
const legalInfo = smartconfigJson?.['tsdoc']?.legal;
|
||||||
if (!legalInfo) {
|
if (!legalInfo) {
|
||||||
|
|||||||
+9
-6
@@ -3,12 +3,12 @@ import * as plugins from './plugins.js';
|
|||||||
import * as aiDocsClasses from './aidocs_classes/index.js';
|
import * as aiDocsClasses from './aidocs_classes/index.js';
|
||||||
|
|
||||||
export class AiDoc {
|
export class AiDoc {
|
||||||
private openaiToken: string;
|
private openaiToken = '';
|
||||||
|
|
||||||
public smartconfigKV: plugins.smartconfig.KeyValueStore;
|
public smartconfigKV?: plugins.smartconfig.KeyValueStore<{ OPENAI_TOKEN: string }>;
|
||||||
public qenvInstance: plugins.qenv.Qenv;
|
public qenvInstance!: plugins.qenv.Qenv;
|
||||||
public aidocInteract: plugins.smartinteract.SmartInteract;
|
public aidocInteract!: plugins.smartinteract.SmartInteract;
|
||||||
public model: plugins.smartai.LanguageModelV3;
|
public model!: plugins.smartai.LanguageModelV3;
|
||||||
|
|
||||||
argvArg: any;
|
argvArg: any;
|
||||||
|
|
||||||
@@ -35,7 +35,10 @@ export class AiDoc {
|
|||||||
// lets care about prerequisites
|
// lets care about prerequisites
|
||||||
this.aidocInteract = new plugins.smartinteract.SmartInteract();
|
this.aidocInteract = new plugins.smartinteract.SmartInteract();
|
||||||
this.qenvInstance = new plugins.qenv.Qenv();
|
this.qenvInstance = new plugins.qenv.Qenv();
|
||||||
if (!(await this.qenvInstance.getEnvVarOnDemand('OPENAI_TOKEN'))) {
|
const openaiTokenFromEnv = await this.qenvInstance.getEnvVarOnDemand('OPENAI_TOKEN');
|
||||||
|
if (openaiTokenFromEnv) {
|
||||||
|
this.openaiToken = openaiTokenFromEnv;
|
||||||
|
} else {
|
||||||
// Migrate old KV store path to new path if needed
|
// Migrate old KV store path to new path if needed
|
||||||
const homeDir = plugins.smartpath.get.home();
|
const homeDir = plugins.smartpath.get.home();
|
||||||
const oldKvPath = plugins.path.join(homeDir, '.smartconfig/kv/tsdoc.json');
|
const oldKvPath = plugins.path.join(homeDir, '.smartconfig/kv/tsdoc.json');
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export class TypeDoc {
|
|||||||
|
|
||||||
// Instance
|
// Instance
|
||||||
public typedocDirectory: string;
|
public typedocDirectory: string;
|
||||||
constructor(dirPathArg) {
|
constructor(dirPathArg: string) {
|
||||||
this.typedocDirectory = dirPathArg;
|
this.typedocDirectory = dirPathArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,9 +28,8 @@ export class TypeDoc {
|
|||||||
moduleResolution: 'NodeNext',
|
moduleResolution: 'NodeNext',
|
||||||
esModuleInterop: true,
|
esModuleInterop: true,
|
||||||
verbatimModuleSyntax: true,
|
verbatimModuleSyntax: true,
|
||||||
skipLibCheck: true,
|
|
||||||
},
|
},
|
||||||
include: [],
|
include: [] as string[],
|
||||||
};
|
};
|
||||||
let startDirectory = '';
|
let startDirectory = '';
|
||||||
if (await plugins.fsInstance.directory(plugins.path.join(paths.cwd, './ts')).exists()) {
|
if (await plugins.fsInstance.directory(plugins.path.join(paths.cwd, './ts')).exists()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user