Compare commits

...

10 Commits

7 changed files with 83 additions and 44 deletions

View File

@ -1,4 +1,40 @@
# Changelog
## 1.2.2
fix(aidocs): Fix bug in AiDoc class causing undefined token handling
## 23.06.2024 - 1.3.2 - fix(aidocs_classes)
Fix typo in INextCommitObject interface and update date format in changelog generation.
- Corrected typo in INextCommitObject interface within the aidocs_classes directory.
- Updated date format in changelog generation from European format to hyphened sortable format.
```markdown
## 2023-xx-xx - 1.3.1 - aidocs_classes
Fix typo in INextCommitObject interface
- Corrected a minor typo in the INextCommitObject interface for consistency.
## 2023-xx-xx - 1.3.0 - core
Added smarttime dependency and improved changelog generation
- Introduced smarttime dependency to the core module.
- Enhanced changelog generation to be more efficient.
## 2023-xx-xx - 1.2.4 - logging
Refactor logger initialization to use commitinfo data
- Logger initialization now utilizes commitinfo data for better context and accuracy.
## 2023-xx-xx - 1.2.3 - aidocs
Fix bug in AiDoc class causing undefined token handling
- Resolved an issue in the AiDoc class where undefined tokens were not being handled correctly.
## 2023-xx-xx - 1.2.1 - core
Fixed usage of plugins in project context and readme generation
- Improved the usage of plugins within the project context.
- Fixed issues related to README.md generation.
## 2023-xx-xx - 1.2.0 - aidocs_classes
Enhance changelog generation by supporting complete generation in the absence of previous changelog files
- Updated changelog generation to support complete generation even when previous changelog files are absent.
## 2023-xx-xx - 1.1.42 - aidoc_classes
Improve commit message generation by handling empty diffs and updating changelog instructions
- Enhanced commit message generation to handle empty diffs.
- Updated instructions for changelog generation for better clarity.
```

View File

@ -1,6 +1,6 @@
{
"name": "@git.zone/tsdoc",
"version": "1.2.2",
"version": "1.3.2",
"private": false,
"description": "An advanced TypeScript documentation tool using AI to generate and enhance documentation for TypeScript projects.",
"type": "module",
@ -39,6 +39,7 @@
"@push.rocks/smartlog-destination-local": "^9.0.2",
"@push.rocks/smartpath": "^5.0.18",
"@push.rocks/smartshell": "^3.0.5",
"@push.rocks/smarttime": "^4.0.6",
"typedoc": "^0.26.0",
"typescript": "^5.5.2"
},

3
pnpm-lock.yaml generated
View File

@ -47,6 +47,9 @@ importers:
'@push.rocks/smartshell':
specifier: ^3.0.5
version: 3.0.5
'@push.rocks/smarttime':
specifier: ^4.0.6
version: 4.0.6
typedoc:
specifier: ^0.26.0
version: 0.26.0(typescript@5.5.2)

View File

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

View File

@ -6,6 +6,7 @@ export interface INextCommitObject {
recommendedNextVersionLevel: 'fix' | 'feat' | 'BREAKING CHANGE'; // the recommended next version level of the project
recommendedNextVersionScope: string; // the recommended scope name of the next version, like "core" or "cli", or specific class names.
recommendedNextVersionMessage: string; // the commit message. Don't put fix() feat() or BREAKING CHANGE in the message. Please just the message itself.
recommendedNextVersionDetails: string[]; // detailed bullet points for the changelog
recommendedNextVersion: string; // the recommended next version of the project, x.x.x
changelog?: string; // the changelog for the next version
}
@ -49,10 +50,12 @@ Important: Answer only in valid JSON.
Your answer should be parseable with JSON.parse() without modifying anything.
Here is the structure of the JSON you should return:
{
interface {
recommendedNextVersionLevel: 'fix' | 'feat' | 'BREAKING CHANGE'; // the recommended next version level of the project
recommendedNextVersionScope: string; // the recommended scope name of the next version, like "core" or "cli", or specific class names.
recommendedNextVersionMessage: string; // the commit message. Don't put fix() feat() or BREAKING CHANGE in the message. Please just the message itself.
recommendedNextVersionDetails: string[]; // detailed bullet points for the changelog
recommendedNextVersion: string; // the recommended next version of the project, x.x.x
}
@ -76,40 +79,43 @@ Also you are given a diff
if (await plugins.smartfile.fs.fileExists(previousChangelogPath)) {
previousChangelog = await plugins.smartfile.SmartFile.fromFilePath(previousChangelogPath);
}
if (!previousChangelog) {
let result2 = await this.aiDocsRef.openaiInstance.chat({
messageHistory: [],
systemMessage: `
You are building a changelog file for the projext.
You are building a changelog.md file for the project.
Omit commits and versions that lack relevant changes.
You are given
* the previous changelog file (if available)
A changelog entry should look like this:
## yyyy-mm-dd - x.x.x - scope here
main descriptiom here
- detailed bullet points follow
You are given:
* the commit messages of the project
Only return the changelog file, so it can be written directly to changelog.md
For the latest version, that is not yet part of the commit messages, add a placeholder entry that uses {{nextVersion}} and {{nextVersionMessage}} as variables to filled later.
Only output newer versions and their changes compared to ones already mentioned. We take of appending your output later.
If there is no previous changelog file, generate a complete changelog from commit messages with heading and everything + the placeholder section mentioned above.
`,
Only return the changelog file, so it can be written directly to changelog.md`,
userMessage: `
The previous changelog file is:
${!previousChangelog ? 'No previous changelog file found' : previousChangelog.contents.toString()}
Here are the commit messages:
Here are the commit messages so far:
${commitMessages.join('\n\n')}
`,
${commitMessages.join('\n')}
`,
});
if (previousChangelog) {
let newChangelog = result2.message;
newChangelog = newChangelog.replace('# Changelog\n\n', '');
let oldChangelog = previousChangelog.contents.toString().replace('# Changelog\n\n', '');
newChangelog = `# Changelog\n\n${newChangelog}\n\n${oldChangelog}`;
resultObject.changelog = newChangelog;
} else {
resultObject.changelog = result2.message;
previousChangelog = await plugins.smartfile.SmartFile.fromString(previousChangelogPath, result2.message, 'utf8');
}
let oldChangelog = previousChangelog.contents.toString().replace('# Changelog\n\n', '');
let newDateString = new plugins.smarttime.ExtendedDate().exportToHyphedSortableDate();
let newChangelog = `# Changelog\n\n${
`## ${newDateString} - {{nextVersion}} - {{nextVersionScope}}
{{nextVersionMessage}}
{{nextVersionDetails}}
`}\n\n${oldChangelog}\n`;
resultObject.changelog = newChangelog;
return resultObject;
}
}

View File

@ -1,15 +1,6 @@
import { commitinfo } from './00_commitinfo_data.js';
import * as plugins from './plugins.js';
export const logger = new plugins.smartlog.Smartlog({
logContext: {
company: 'Some Company',
companyunit: 'Some CompanyUnit',
containerName: 'Some Containername',
environment: 'local',
runtime: 'node',
zone: 'gitzone',
},
minimumLogLevel: 'silly',
});
export const logger = plugins.smartlog.Smartlog.createForCommitinfo(commitinfo);
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());

View File

@ -16,6 +16,7 @@ import * as smartlog from '@push.rocks/smartlog';
import * as smartlogDestinationLocal from '@push.rocks/smartlog-destination-local';
import * as smartpath from '@push.rocks/smartpath';
import * as smartshell from '@push.rocks/smartshell';
import * as smarttime from '@push.rocks/smarttime';
export {
npmextra,
@ -30,6 +31,7 @@ export {
smartlogDestinationLocal,
smartpath,
smartshell,
smarttime,
};
// third party scope